Ryan Timothy: Regular expressions are also great for scenarios like that. Something like:
Code: ags
I'm sure it can be done way better than that, but it's just an example. Not even sure if it's faster and more efficient than Calin's methods.
$new_str = preg_replace('/([^0-9]*?)([0-9]+?)([^0-9]*?)/i', '$1 inserta$2insertb #3', $old_str);
I'm sure it can be done way better than that, but it's just an example. Not even sure if it's faster and more efficient than Calin's methods.