3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "it is a test string."; echo preg_replace(['~\Ar~', '~.{3}\K(?>r|.(*SKIP)(?!))~'], 'm', $str);

preferences:
24.3 ms | 404 KiB | 5 Q