Doc #60114 [Opn]: operator increment not working as expected

From: Date: Sat, 22 Oct 2011 17:14:36 +0000
Subject: Doc #60114 [Opn]: operator increment not working as expected
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7344@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60114&edit=1 ID: 60114 User updated by: luuk34 at gmail dot com Reported by: luuk34 at gmail dot com Summary: operator increment not working as expected Status: Open Type: Documentation Problem Package: *General Issues PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: The actual result should even be: 111 and not: 011 Previous Comments: ------------------------------------------------------------------------ [2011-10-22 16:46:24] luuk34 at gmail dot com Description: ------------ --- From manual page: http://www.php.net/language.operators.increment --- I think there's an error in the second example: $foo=($foo++); it should assign 0 to $foo, and after that increment $foo with 1. But the value of $foo after this line of code is still 0. Test script: --------------- <?php $foo=0; $foo=$foo++; print $foo; $foo=0; $foo=($foo++); print $foo; $foo=0; $foo++; print $foo; ?> Expected result: ---------------- 011 Actual result: -------------- 001 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60114&edit=1

« previous php.doc.bugs (#7344) next »