Skip to content

Instantly share code, notes, and snippets.

@mwhite mwhite/foo.js
Created Jun 30, 2012

Embed
What would you like to do?
Amusing JS vs. PHP comparison
(function foo(x) {
return function bar() {
alert(x);
};
})("foo");
(function foo(x) {
return function bar() {
alert(x);
};
})("foo")();
<?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
You can’t perform that action at this time.