Re: Closures in PHP
| From: | Nathan Nobbe | Date: | Tue, 15 Jan 2008 18:30:20 +0000 |
| Subject: | Re: Closures in PHP | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267318@lists.php.net to get a copy of this message | ||
On Jan 15, 2008 7:31 AM, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> when i said a function would have to be loaded into the interpreter to
> avoid a runtime error
> upon invocation, i didnt mention that its best to programatically verify
> it can be called before
> letting the runtime error occur (of course you can let that happen if you
> prefer :)), to avoid it.
> anywho, i prefer the variable function construct more than
> call_user_func(), simply
> because it feels a bit more natural to me, but semantically, they are the
> same, they just have
> a different syntax is all. i suppose call_user_func() is a bit more clear
> and might help some
> people when drifting through the code of others.
> cool contrived example, btw ;)
>
actually, it does appear that call_user_func() and call_user_func_array()
are
a bit more powerful than variable functions as they permit a dynamic number
of actual parameters, whereas the number of parameters using the variable
function construct is static.
-nathan