Advanced PHP Problems -- For Fun
Posted: Fri Sep 26, 2008 10:45 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
1. What is a design Pattern (If you don’t know Wikipedia is probably a good place to start)
2. Given,
How can you call the function foobar(“really”); without directly calling the function foobar. Hint (use $POINT );
3. Do you think the following is funny? If so why? (Taken from http://readlist.com/lists/lists.php.net ... 26553.html)
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
1. What is a design Pattern (If you don’t know Wikipedia is probably a good place to start)
2. Given,
Code: Select all
$POINT = “foobar”;
Function foobar($how_bar);
{
Echo “not just foobar, $how_bar foobar.”;
}3. Do you think the following is funny? If so why?
Code: Select all
<?
function at($level) {
$level == 10 ? $ret = "winner" : '';
$level == 15 ? $ret = "try" : '';
$level == 20 ? $ret = "first" : '';
$level == 25 ? $ret = "user" : '';
$level == 30 ? $ret = "place" : '';
$level == 35 ? $ret = "again" : '';
$level == 40 ? $ret = "succeed" : '';
$level == 45 ? $ret = "last" : '';
$level == 50 ? $ret = "finish" : '';
return $ret;
}
if(at(20) != "succeed") {
try {
$e = "again";
throw new Exception($e);
} catch(Exception $e) {
echo "Try ".$e->getMessage()."\n";
}
}
?>~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: