Notice that this behavior can be reproduced using only prefix increment operators.
<?php $a = 10; $b = &$a; echo (++$a) + (++$a); // 24 ?> <?php $a = 10; //$b = &$a; echo (++$a) + (++$a); // 23 ?> Is that also expected to give undefined results ? Best regards Hartmut Holzgraefe a écrit : > Marco Kaiser wrote: >> Today during a session i had a strange "magic" feature found in php. >> >> <?php >> $a = 10; >> echo ++$a + $a++; >> ?> > > there is a very simple rule that PHP inherited from C: > > never use pre- and postfix increment operators in the same expression > > as the results are undefined > -- Etienne Kneuss http://www.colder.ch/ [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php