Re: [PHP] Re: Creating methods runtime

2002-02-22 Thread Mika Tuupola
On Thu, 21 Feb 2002, Matthew J Gray wrote: > No there really isn't. I wrote an extension that does it for me, but > I am waiting to see what the second zend engine will have for this > rather that using my hack. Maybe check the Zend Engine 2 mailing list > to see what the future may hold.

RE: [PHP] Re: Creating methods runtime

2002-02-21 Thread Martin Towell
dunno about using eval() but this worked - not as elegant as I'd want it, but it works class test { function user_func($f, $a, $b) { $z = $this->$f; return ($z ? $z($a, $b) : null); } } $blah = new test; $blah->new_func = create_function('$a,$b', 'return $a+$b;'); echo $blah->user_func("new_fu