note 19958 added to function.strpos
| From: | php-general at lists dot php dot net | Date: | Sat, 16 Mar 2002 19:58:48 +0000 |
| Subject: | note 19958 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27860@lists.php.net to get a copy of this message | ||
One easy way I found when looking at the PHP source of someone else is this:
(note that its psudocode, syntax may be off a bit)
$pos = substr (haystack, " " . needle) - 1;
if ($pos == -1) {
//not found
}
else {
//found
}
--
http://www.php.net/manual/en/function.strpos.php
http://master.php.net/manage/user-notes.php?action=edit+19958
http://master.php.net/manage/user-notes.php?action=delete+19958
http://master.php.net/manage/user-notes.php?action=reject+19958