note 83914 added to function.strpos
| From: | paul at thiswayupdesign dot co dot uk | Date: | Wed, 18 Jun 2008 10:48:51 +0000 |
| Subject: | note 83914 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140561@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:
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
----
Server IP: 87.124.64.96
Probable Submitter: 78.86.125.130
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/83914
Del: integrated -- https://master.php.net/note/delete/83914/integrated
Del: useless -- https://master.php.net/note/delete/83914/useless
Del: bad code -- https://master.php.net/note/delete/83914/bad+code
Del: spam -- https://master.php.net/note/delete/83914/spam
Del: non-english -- https://master.php.net/note/delete/83914/non-english
Del: in docs -- https://master.php.net/note/delete/83914/in+docs
Del: other reasons-- https://master.php.net/note/delete/83914
Reject -- https://master.php.net/note/reject/83914
Search -- https://master.php.net/manage/user-notes.php