Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP lambdas: Bitch & Whine.

Name: Anonymous 2008-10-12 19:51

Why the FUCK can't I assign functions to magic methods?
% php -r 'class Whut{function __construct(){ $this->__call = function ($m, $v) { echo "Calling: ", $m; }; } } $n = new Whut; $n->whut();'
Fatal error: Call to undefined method Whut::whut() in Command line code on line
1


Wait, I can't even use them as methods?
% php -r 'class Whut{function __construct(){ $this->__call = function ($m, $
v) { echo "Calling: ", $m; }; } } $n = new Whut; $n->__call("whut", array());'
Fatal error: Call to undefined method Whut::__call() in Command line code on lin
e 1


And, dude, what the shit!?
% php -r 'function lol(){return function () {echo "Hello."; }; } lol()();'
Parse error: syntax error, unexpected '(' in Command line code on line 1


Ok, how about...
% php -r 'function lol(){return function () {echo "Hello."; }; } (lol())();                       $n();'
Parse error: syntax error, unexpected '(' in Command line code on line 1


So, I abso-fucking-lutely have to assign it?
% php -r 'function lol(){return function () {echo "Hello."; }; } $n = lol();
 $n();'
Hello!


Oh, screw you, god damn faggots.

Name: Anonymous 2008-10-14 11:34

>>13
He also probably gets shit done, and makes money doing it, unlike the basement dwelling faggots who seem to comprise most of the population of /prog/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List