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

[ad_1]

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

[ad_2]

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