function pregReplaceAll(string $find, string $replacement, string $s): string { while(preg_match($find, $s)) { $s = preg_replace($find, $replacement, $s); } return $s; }
Programming Tips - PHP: Where is PHP's preg_replace_all?
Date: 2010mar28
Language: php
Q. PHP: Where is PHP's preg_replace_all?
A. Here it is: