Created
June 30, 2012 00:17
-
-
Save mwhite/3021543 to your computer and use it in GitHub Desktop.
Amusing JS vs. PHP comparison
This file contains 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
(function foo(x) { | |
return function bar() { | |
alert(x); | |
}; | |
})("foo"); | |
(function foo(x) { | |
return function bar() { | |
alert(x); | |
}; | |
})("foo")(); |
This file contains 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
<?php | |
call_user_func(function foo($x) { | |
return function bar() use ($x) { | |
echo $x; | |
}; | |
}, "foo"); | |
call_user_func(call_user_func(function foo($x) { | |
return function bar() use ($x) { | |
echo $x; | |
}; | |
}, "foo")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment