Julien Pauli <jpa...@php.net> wrote:

>On Tue, Mar 19, 2013 at 12:42 AM, Stas Malyshev
><smalys...@sugarcrm.com>wrote:
>
>> Hi!
>>
>> > Also, AFAIR, call_user_func() doesn't work with functions using
>> references
>> > in args.
>>
>> Use call_user_func_array() for that, it supports refs.
>>
>
>Isn't it since 5.3 or so ?

Before 5.3 call_uer_func_array() could convert copied values in the array to 
references, something like

    <?php
    $v = 42; 
    $a = array($v);

    func f(&$param) { $param = 0; }

    call_user_func_array('f', $a);
    echo $v; // prints 0
    ?>

"worked", while obviously being wrong. This was fixed.

Anyways, both call_user_func() and call_user_func_array() have their place, one 
for doing dynamic stuff, secondly for compatibility, no need to get rid of 
those. Adding syntactical sugar for calling things is a different question, but 
a key element of the PHP language design is to have verbosity, so that even 
people who don't know all constructs have a chance to search for it. We're 
getting rid of this slowly (i.e. due to things like $a = [ ] ) but we houldn't 
loose this idea completely.

johannes

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to