Garvin Hicking schrieb:
Hi!
the problem is not that this variable is not assigned in the function call, but it is assigned AFTER the function is executed:
[...]
This is a very good reduced example. I urgently suggest to post this on the PHP Bugtracker, no matter what you think of them - I agree that it is a BC-break which should at least be documented in the ChangeLog of PHP5.
much more confusing:
<?php function myFuncR(&$var) { echo 'before inside function overwrite:'; var_dump($var); echo "\n"; $var = 9999; echo 'after inside function overwrite:'; var_dump($var); echo "\n"; }
$var = 0; echo 'before function call:'; var_dump($var); echo "\n"; myFuncR($var = 20); echo 'after function call:'; var_dump($var); echo "\n"; ?>
before function call:int(0)
before inside function overwrite:int(20)
after inside function overwrite:int(9999)
after function call:int(20)