note 9092 modified in strlen by ronabop

From: Date: Sat, 21 Oct 2000 22:51:34 +0000
Subject: note 9092 modified in strlen by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-6812@lists.php.net to get a copy of this message
To php.net@pinguin.conetix.de: what you describe is not a bug; it's common behaviour in any programming language. In a line like: while($c=$s[$tmp++]) { echo $c; } the while does not fail automatically, because FIRST the condition needs to be evaluated. This can't be done, though, because your condition (being a statement at the same time) is not executable for obvious reasons - therefore the interpreter never reaches the point where he could end the while loop. Imagine it as if you wrote it something like this and you'll see why it could never work: $c=$s[$tmp++]; while($c) { echo $c; $c=$s[$tmp++]; } http://www.php.net/manual/function.strlen.php

« previous php.notes (#6812) next »