Split haystack at nth occurrence of needle?
| From: | Brian Dunning | Date: | Wed, 22 Sep 2004 15:54:56 +0000 |
| Subject: | Split haystack at nth occurrence of needle? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197575@lists.php.net to get a copy of this message | ||
I've been RTFMing for about an hour and I can't find a string function to split haystack 'one<br>two<br>three<br>four<br>five' at the nth occurrence of needle '<br>'. strpos gives me the position of the first needle, and strrpos gives me the position of the last needle. But I'm looking for the position of one of the in-between needles, so that I can use substr() to trim everything from there on. What very obvious function was I unable to find in the manual?
Thanks,
- Brian