[EMAIL PROTECTED] wrote in php.bugs:

> [2002-11-27 07:04:52] [EMAIL PROTECTED]
> 
> <? 
> $a = 7;
> $a = $a + $a++;
> echo $a; 
> //the result is 14;
> ?>
> 
> When I add a reference to $a, the behavior of $a + $a++ becomes
> inexplicable different. Note that $a isn't changed anywhere!
> 
> <?
> $a = 7;
> $b =& $a;
> $a = $a + $a++;
> echo $a; 
> //the result is 15;
> ?>
> 
> The only difference is $b =& $a, but why $a takes care of references to
> itself?

Ilia verified the bug, and I can reproduce that behaviour here as well.
But I'm not sure whether the expressions

  $a = $a + $a++;

or

  $x = $a + $a++;

really are valid/legal/well-defined expressions. When exactly is that
$a++ meant to be interpreted/executed? Before or after that other $a is
looked at?

I know that PHP is not C, but hasn't that something to do with sections
3.1 to 3.3 of the C FAQ, <http://www.eskimo.com/~scs/C-faq/s3.html>?

Regards...
                Michael

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

Reply via email to