Is it possible to use create_function() to define anonymous methods (like in Java) ?
I mean something like:
class Listener { function listen () { return 'I am an abstract method'; } }
$listener = new Listener(); $listener->listen = create_function ( '', 'return "I am an anonymous method";' );
echo $listener->listen();
The above code doesn't work, "abstract method" is printed. I've read I could define a private variable that stores a function and use it inside a method. But it's not what I want: I want dynamically overload the methods of several already defined functions. Is there some way to do it?
Thanks in advance for an answer.
Marco.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php