Skip to content

Instantly share code, notes, and snippets.

@gtgt
Created July 22, 2016 10:47
Show Gist options
  • Save gtgt/408d0d77cabd77675a1a63985178bd47 to your computer and use it in GitHub Desktop.
Save gtgt/408d0d77cabd77675a1a63985178bd47 to your computer and use it in GitHub Desktop.
Warm-up questions for job seekers.
/* Case 1 */
<?php
header('Content-Type: text/css');
$exit_normally = 0;
register_shutdown_function(function() {
register_shutdown_function(function() {
global $exit_normally;
if (!$exit_normally) {
echo "/*\n".ob_get_clean()."\n*/\n";
}
});
});
/* ...do stuff... */
$exit_normally = 1;
exit;
/* Case 2 */
<?php
header('Content-Type: text/css');
$exit_normally = 0;
register_shutdown_function(function() use($exit_normally) {
register_shutdown_function(function() use($exit_normally) {
if (!$exit_normally) {
echo "/*\n".ob_get_clean()."\n*/\n";
}
});
});
/* ...do stuff... */
$exit_normally = 1;
exit;
/* Case 3 */
<?php
header('Content-Type: text/css');
$exit_normally = 0;
register_shutdown_function(function() use(&$exit_normally) {
register_shutdown_function(function() use($exit_normally) {
if (!$exit_normally) {
echo "/*\n".ob_get_clean()."\n*/\n";
}
});
});
/* ...do stuff... */
$exit_normally = 1;
exit;
/* Case 4 */
<?php
header('Content-Type: text/css');
$exit_normally = 0;
register_shutdown_function(function() use(&$exit_normally) {
register_shutdown_function(function() use(&$exit_normally) {
if (!$exit_normally) {
echo "/*\n".ob_get_clean()."\n*/\n";
}
});
});
/* ...do stuff... */
$exit_normally = 1;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment