Re: Could we kill call_user_func?
| From: | Bob Weinand | Date: | Fri, 15 Mar 2013 15:42:10 +0000 |
| Subject: | Re: Could we kill call_user_func? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66651@lists.php.net to get a copy of this message | ||
Am 15.3.2013 um 15:50 schrieb Ángel González <keisial@gmail.com>:
> On 15/03/13 15:19, Steve Clay wrote:
>> I'm sure this question has been discussed before, so if anyone can
>> point to me to links or briefly recap I'd appreciate it.
>>
>> Why can't we make $someCallable() always work? E.g.
>> http://3v4l.org/FLpAq
>>
>> I understand the problem of $obj->foo() where ->foo is a callable
>> property. The workaround could be:
>>
>> ($obj->foo)();
>>
>> call_user_func() just seems so ugly now that we have nicer syntax in
>> so many other areas.
>>
>> Steve Clay
> No.
>
> What if I want to call functions with a variable number of arguments?
>
> For instance, the common piece of a hook system implementation, where
> the arguments of the functions called vary depending on the hook.
call_user_func is not call_user_func_array
call_user_func($func) is the same as $func(). In any way.
Bob Weinand