note 9092 added to strlen
| From: | h9450570 at falbala dot wu-wien dot ac dot at | Date: | Mon, 16 Oct 2000 09:34:31 +0000 |
| Subject: | note 9092 added to strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6518@lists.php.net to get a copy of this message | ||
To php.net@pinguin.conetix.de below:
what you describe on the PHP Man page for strlen
(http://www.php.net/strlen) is not a bug; it's common behaviour in any
programming language.
In a line like your
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