note 61136 added to function.strpos
| From: | SteveCambridgeUK at osu1 dot php dot net | Date: | Thu, 26 Jan 2006 15:16:45 +0000 |
| Subject: | note 61136 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102490@lists.php.net to get a copy of this message | ||
I have on many occasion used strpos...but i always use a dodge to get around the 0 / false return.
$findme = "a";
$haystack = "abcd";
$pos = strpos($haystack, $findme);
$pos will be 0....
so i do this....
$findme = "a";
$haystack = "abcd";
$pad = "X";//or anything i ain't looking for...:P
$haystack = $pad . $haystack;
$pos = strpos($haystack, $findme);
$pos cannot be 0..
----
Server IP: 85.116.0.130
Probable Submitter: 62.253.128.11 (proxied: 86.15.188.197)
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61136
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61136&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61136&report=yes
Search -- http://master.php.net/manage/user-notes.php