Skip to content

Instantly share code, notes, and snippets.

@atmoz
Created February 19, 2010 17:44
Show Gist options
  • Save atmoz/308968 to your computer and use it in GitHub Desktop.
Save atmoz/308968 to your computer and use it in GitHub Desktop.
<?php
/**
* PHP Quiz #1
*
* What is the function definition of hello()?
*
* function hello() {
* ...
* }
*
*
* Result: "Hello to the following people: Higgs, Euler, Hanse, Noah"
*/
function hello($array) {
return function() use ($array) {
echo 'Hello to the following people: ' . implode(', ', array_reverse($array));
};
}
$hello = hello(array('Noah', 'Hanse', 'Euler', 'Higgs'));
$hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment