Is there anyway to skip the first match when using regex and php.
Or is there some way of achieveing this using str_replace.
Thanks
UPDATE
I am trying to remove all the instances of a string from another string but I want to retain the first occurance e.g
$toRemove = 'test';
$string = 'This is a test string to test to removing the word test';
Ouput string would be:
This is a test string to test to removing the word test
Easy PHP way:
will give you “AN”.
UPDATE: Didn’t know it was a replace. Try this:
Find the first match and remember where it was, then delete everything, then put whatever was in the first spot back in.