Using str_replace so that it only acts on the first match?

I want a version of str_replace() that only replaces the first occurrence of $search in the $subject. Is there an easy solution to this, or do I need a hacky solution?

22 Answers
22

Leave a Comment