[nycphp-talk] "Calling" an object
Andrew Yochum
andrew at plexpod.com
Fri Dec 9 23:08:34 EST 2005
I want to reproduce the equivalent of Python's magic __call__ method in
PHP 5. More or less this might look like:
class foo {
function __call__() { return "bar"; }
}
$o = new foo();
$s = $o();
// $s = "bar"
But of course, that doesn't work. Using __toString() doesn't quite cut it as
that only works w/ echo & print.
Ideas?
Regards,
Andrew
--
Andrew Yochum
Plexpod
andrew at plexpod.com
718-360-0879
More information about the talk
mailing list