note 10182 deleted from function.strlen by dams

From: Date: Sat, 27 Jul 2002 16:23:21 +0000
Subject: note 10182 deleted from function.strlen by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-33673@lists.php.net to get a copy of this message
The problem you are having is not a problem, it seems to be user misunderstanding. When you are performing your loop, you are trying to use the assignment of $s[$tmp++] into $c as a condition you can check (in this case you are trying to check for a failure (or boolean false). But before the condition of the assignment can be checked it has to actually perform the assignment, which is when you are having the error thrown. This is because you are trying to get data past the end of the string. This is a bad practice to get into - using your assignment statements as conditional checks. It really isn't smart to try and chunk a whole heap of things into one statement. It certainly doesn't produce more legible code and the compiler doesn't care one way or the other, it still makes the same amount of compiled statements once it has parsed your code.

« previous php.notes (#33673) next »