3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $searchTerm = "abcd"; $replaceTerm = "XXXX"; $test=array("${searchTerm}/${searchTerm}_.${searchTerm}", "xay${searchTerm}", "asdasd/${searchTerm}.mp3", "${searchTerm}.", "blahahbasd${searchTerm}", "1234${searchTerm}1234", "${searchTerm}"); foreach ($test as $t) echo "$t => " . preg_replace("/". preg_quote($searchTerm) . "([^_.]|$)/x", preg_quote($replaceTerm) . "\${1}", $t) . "\n";
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
abcd/abcd_.abcd => XXXX/abcd_.XXXX xayabcd => xayXXXX asdasd/abcd.mp3 => asdasd/abcd.mp3 abcd. => abcd. blahahbasdabcd => blahahbasdXXXX 1234abcd1234 => 1234XXXX1234 abcd => XXXX
Output for hhvm-3.10.0

Process exited with code 153.