Jump to content

Replace 2Nd Occurrence Of String In String..?


cyfer65

Recommended Posts

A combination of strpos() and subsrt_replace()The substr_replace() method has two parameters indicating the start and length of the portion to remove, and one parameter for the string to put in that location. Use strpos() to figure out the first position, then use strpos() again, using the index returned by the first one to find the second occurence. The length of the string you're searching for should be used as the length used in the substr_replace() method.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...