I can't seem to find anything of this, and was wondering if it's possible to store a function or function reference as a value for an array element (e.g. array("someFunc"=>&x(), "anotherFunc"=>$this->anotherFunc())). Thanks!
You can "reference" any function. A function reference is not a reference in the sense of "address in memory" or something. It's merely the name of the function.
|
|||||
feedback
|
check out PHP's consider two functions
now if you want to execute all the function in a sequence you can do it with a loop.
plus array can hold any data type, be it function call, nested arrays, object, string, integer etc. etc. |
||||
feedback
|
Yes, you can:
This does, of course, require PHP anonymous function support, which arrived with PHP version 5.3.0. This is going to leave you with quite unreadable code though. |
|||||||||
feedback
|
PHP supports the concept of variable functions, so you can do something like this:
Yout can check more examples in manual. |
|||||
feedback
|