Created
July 22, 2016 10:47
-
-
Save gtgt/408d0d77cabd77675a1a63985178bd47 to your computer and use it in GitHub Desktop.
Warm-up questions for job seekers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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