[Solved] How to add sub string to each element in a string seperated by comma


I guess the quickest fix would be preg_replace?
This should work:

$str = preg_replace("https://stackoverflow.com/"([0-9]{1})/","'000\\1",$str);

It is replacing every instance of a single quote followed by 1 number with a single-quote, then 3 zeros and then the number we matched

solved How to add sub string to each element in a string seperated by comma