note 69029 added to function.strpos
| From: | dorphalsig-NOSPAM- at -NOSPAM-gmail dot com | Date: | Sun, 20 Aug 2006 16:16:04 +0000 |
| Subject: | note 69029 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116093@lists.php.net to get a copy of this message | ||
here is a strpos that will accept $needle as an array and will search $haystack for any of the
$needles in the array. Please note it will return the position of the FIRST encounter of any of
$needles.
That is: if $haystack="Jan Feb Mar Apr" and
$Needles=array("Jan","Feb","Mar","Apr"), the result will be
0.
function strposarray($haystack,$needles,$offset=0)
{
$pos=false;
$i=0;
while($pos===false)
{
$pos=strpos($haytstack,$needles[$i],$offset);
$i++;
}
return $pos
}
----
Server IP: 66.163.161.117
Probable Submitter: 200.106.168.254
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/69029
Del: integrated -- https://master.php.net/note/delete/69029/integrated
Del: useless -- https://master.php.net/note/delete/69029/useless
Del: bad code -- https://master.php.net/note/delete/69029/bad+code
Del: spam -- https://master.php.net/note/delete/69029/spam
Del: non-english -- https://master.php.net/note/delete/69029/non-english
Del: in docs -- https://master.php.net/note/delete/69029/in+docs
Del: other reasons-- https://master.php.net/note/delete/69029
Reject -- https://master.php.net/note/reject/69029
Search -- https://master.php.net/manage/user-notes.php