note 21956 added to function.strpos
| From: | thedane at high-teck dot com | Date: | Sat, 01 Jun 2002 12:12:37 +0000 |
| Subject: | note 21956 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31322@lists.php.net to get a copy of this message | ||
Is there any way to find the nth occurance of a string within a haystack?
I've been looking at strpos() and strrpos() but they only take the first or last, but
that's not it
Now I know it's possible to find the second occurance by finding the first occurance and
starting the search in the haystack from the end of the first length of the first occurance, and so
on, but it's not really efficient i reckon .,
anyone got an efficient way to do this ?
--
http://www.php.net/manual/en/function.strpos.php
http://master.php.net/manage/user-notes.php?action=edit+21956
http://master.php.net/manage/user-notes.php?action=delete+21956
http://master.php.net/manage/user-notes.php?action=reject+21956