3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $searchTerm = "ü"; $searchTerm2 = "&uuml;"; $replaceTerm = "%FC"; $test=array("${searchTerm}$searchTerm2/${searchTerm}_.${searchTerm}", "xay${searchTerm}", "asdasd/${searchTerm}.mp3", "${searchTerm}.", "blahahbasd${searchTerm}", "1234${searchTerm}1234"); foreach ($test as $t) echo "$t => " . preg_replace("/". preg_quote($searchTerm . '|' . searchTerm2) . "/x", preg_quote($replaceTerm) , $t) . "\n";
based on KUsbU
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 ü&uuml;/ü_.ü => ü&uuml;/ü_.ü Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 xayü => xayü Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 asdasd/ü.mp3 => asdasd/ü.mp3 Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 ü. => ü. Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 blahahbasdü => blahahbasdü Notice: Use of undefined constant searchTerm2 - assumed 'searchTerm2' in /in/ZaQlI on line 8 1234ü1234 => 1234ü1234