Re: Bug #1452 Updated: $i = $i++ fails

From: Date: Tue, 25 May 1999 23:42:44 +0000
Subject: Re: Bug #1452 Updated: $i = $i++ fails
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-5999@lists.php.net to get a copy of this message
On May 25, Rasmus Lerdorf wrote: > > In fact, if that loop hangs for you, than it succeeds doing what > > it's supposed to do. $i=$i++ is equivalent to an empty statement. > > Consult the documentation regarding what post-increment is to > > understand why. > > Uh? > > $i = $i++; > > This should be equivalent to doing: > > $i=$i; > $i++; > > at least from my understanding of what post-increment is supposed to do. > > Try this C program: > > int main() { > int i=0; > while(i < 50) { > printf("%d\n",i); > i = i++; > } > } > > It is the equivalent to his example and it correctly counts from 0 to 49, > so I do believe the submitter of this bug is correct. Actually, I believe that this is sort of ambiguous, depending on the order of execution. I suspect even the C behavior may be compiler-dependent. It's a pretty silly thing to do, in any case. Jim -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5999) next »