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-13 17:23

>>10
If you want to get technical, there are no such things as methods or structs or classes. Just functions which take in an additional pointer to some allocated space.
Doesn't sound so hot now, does it punk?

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