Re: Object method as handler functions in PHP4/Zend

From: Date: Wed, 30 Jun 1999 21:08:00 +0000
Subject: Re: Object method as handler functions in PHP4/Zend
References: 1 2 3 4 5 6 7  Groups: php.dev 
Request: Send a blank email to php-dev+get-7903@lists.php.net to get a copy of this message
At 21:19 30/06/99 , Chuck Hagenbuch wrote:
Quoting Zeev Suraski <zeev@zend.com>: If you know you're expecting an object context, make your function accept $obj and $method, and inside the function, call $method() if $obj is empty, or $obj->$method() if it isn't. Would it be possible to add an optional argument specifying an object reference to all of the functions that take a function name as a parameter (array_walk, usort, etc). This would allow you to write: mysort($a, $b, $obj) {} and call: $foo = usort($bar, 'mysort', $foo_object); This at least lets you avoid setting global variables for mysort() to access before calling usort.
It shouldn't be a problem (technically possible). Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il

« previous php.dev (#7903) next »