note 83914 deleted from function.strpos by cmb
| From: | cmb@php.net | Date: | Sun, 02 Jun 2019 08:02:58 +0000 |
| Subject: | note 83914 deleted from function.strpos by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211168@lists.php.net to get a copy of this message | ||
Note Submitter: paul at thiswayupdesign dot co dot uk
----
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