Php- Replace all found items in a string



You may need to replace all occurrences in a string not just the first item found by ‘str_replace’ function. Here we have designed a function to act al a replace_all button in notepad.

 

You can edit the offset, which determines the starting point in the function. so the all $old matches will be replaced by $new with this function. Hope to be useful!



Leave a comment

Your email address will not be published.


*



Contact me Directly!

I am here to help you . . .

Sms and Telegram:

+1 807 907 0016