note 49739 added to function.strpos
| From: | arias at elleondeoro dot com | Date: | Mon, 07 Feb 2005 14:33:47 +0000 |
| Subject: | note 49739 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84617@lists.php.net to get a copy of this message | ||
If you want to get all positions in an array, you can use this function. If the optional parameter
count is especified, the function will put there the number of matches.
function strallpos($pajar, $aguja, $offset=0, &$count=null) {
if ($offset > strlen($pajar)) trigger_error("strallpos(): Offset not contained in
string.", E_USER_WARNING);
$match = array();
for ($count=0; (($pos = strpos($pajar, $aguja, $offset)) !== false); $count++) {
$match[] = $pos;
$offset = $pos + strlen($aguja);
}
return $match;
}
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49739
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49739&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49739&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49739&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49739&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49739&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49739&report=yes
Search -- http://master.php.net/manage/user-notes.php