3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str="Please wait for sometime too, the area code is for 18 and phone number is too 5897 for"; $str=preg_replace('#(\d)\s*for#','${1}4',$str); $str=preg_replace('#(\d)\s*too#','${1}2',$str); $str=preg_replace('#for\s*(\d)#','4${1}',$str); $str=preg_replace('#too\s*(\d)#','2${1}',$str); echo $str;

preferences:
25.19 ms | 402 KiB | 5 Q