Line appearing
I know you can find the first and last occurrence in a string using strstr()
and strchr
, but how do you find the second occurrence and third occurrence of a needle in a haystack? im using this to find the last occurrence of a needle and the first occurrence of another needle and their position, then return the string that is in between. thanks.
+2
a source to share
3 answers
You have to find strstr (), get the result, and start searching from the result in the time that strstr finds nothing new.
You can use for it: http://php.net/manual/en/function.strpos.php
+1
a source to share