note 83914 modified in function.strpos by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:29:57 +0000 |
| Subject: | note 83914 modified in function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154835@lists.php.net to get a copy of this message | ||
I wasn't aware of the !== operator, only the === for false. I was using this code on strpos:
<?php
while( ! ($start=@strpos($source,$startTag,$end)) === false) {
// ...
}
?>
This gave a false if the string was found at position 0, which is weird.
However using
<?php
while(($start=@strpos($source,$startTag,$end)) !== false) {
// ...
}
?>
Gives no such error and seems to work correctly
--was--
I wasn't aware of the !== operator, only the === for false. I was using this code on strpos:
while( ! ($start=@strpos($source,$startTag,$end)) === false)
This gave a false if the string was found at position 0, which is weird.
However using
while(($start=@strpos($source,$startTag,$end)) !== false)
Gives no such error and seems to work correctly
http://php.net/manual/en/function.strpos.php