Re: Inconsistencies in callable, call_user_func and direct variable calls
| From: | Rowan Collins | Date: | Sat, 24 Jan 2015 14:24:56 +0000 |
| Subject: | Re: Inconsistencies in callable, call_user_func and direct variable calls | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81074@lists.php.net to get a copy of this message | ||
On 24 January 2015 00:15:01 GMT, Stanislav Malyshev <smalyshev@gmail.com> wrote:
>Hi!
>
>> Foo::bar(); // OK
>> ['Foo', 'bar'](); // OK
>> 'Foo::bar'(); // FATAL ERROR
>
>I'm not sure why one would ever need/want the latter. IMO, it just
>looks
>weird.
Well, they both look weird as literals like that, but the array looks the wierder of the two to me.
Representing a static call in some external configuration is an example where a single string in
normal PHP syntax would make more sense than needing to create a 2-element array.