note 21956 rejected from function.strpos by torben

From: Date: Sat, 01 Jun 2002 18:39:44 +0000
Subject: note 21956 rejected from function.strpos by torben
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-31326@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 ?

« previous php.notes (#31326) next »