default values in function call behaves differently in PHP5.2.4 and PHP5.0.4
| From: | dor kam | Date: | Mon, 09 Jul 2007 13:36:48 +0000 |
| Subject: | default values in function call behaves differently in PHP5.2.4 and PHP5.0.4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-258495@lists.php.net to get a copy of this message | ||
Hi list.
I am quite new in the area.
I found a difference between PHP 5.2.4 to 5.0.4 in case of passing
parameter to function, with default value:
f1(&$par=0);
in 5.2.4 the par is assigned to zero AFTER function call
and thus, par is always ZERO !
The desired code in 5.2.4 should probably be:
$par=0;
f1(&$par);
in 5.0.4 in is INITIALIZED to zero, BEFORE function call!
and the return value is according to f1.
Am I right?
Is it a bug?
Is it documented?
Thanks
Dor