3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = 123; $str = "some string with tt=789_ and more"; echo preg_replace("/tt=[0-9]+_\K/", $n, $str);

preferences:
31.89 ms | 404 KiB | 5 Q