NYCPHP Meetup

NYPHP.org

[nycphp-talk] function references

Jesse Callaway bonsaime at gmail.com
Sat Jan 10 14:45:49 EST 2009


Is it possible to take a reference to a function and then stick it in an
array?

I'd like to have an array with function names as the keys and the values
would be references to the actual function. This way I could do


do[$that_function];

Basically being lazy and don't want to have a big ugly switch block when I
could just declare the array, the functions, and then call it all in one
line.

Not even sure what the calling syntax would be, so I'm not sticking to this
example but it shows the idea I hope.


Is this more commonly done with some sort of eval() function?

-jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090110/c8fc1cc8/attachment.html>


More information about the talk mailing list