tags:

views:

66

answers:

4
function get_arr($arr)
{
    unset($arr[0]);
}
$arr1 = array(1,2);
$arr2 = array(1,2);

get_arr(&$arr1);
get_arr($arr2);
echo count($arr1);
echo count($arr2);

I got :

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of get_arr(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file

But the output is:

12

Which means the call time reference takes effect.

Why the two places output contradictary messages?

+3  A: 

Deprecated does not mean non-functional, it's just not recommended.

Petr Peller
A: 

It's a warning.

It is just warning you, but at the same time trusts that you know what you are doing.

Morningcoffee
A: 

Call-time pass-by-reference is deprecated, that means it should not be used any more and may not be working in a future version of PHP. It does not mean that it does not work.

Ferdinand Beyer
A: 

the source of confusion is that error message is vague, it should read "to get rid of this warning, set allow_call_time_pass_reference to true" instead of "to enable call-time pass-by-reference".

stereofrog