3v4l.org

run code in 200+ 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 7.2.0
Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 ü&uuml;/ü_.ü => ü&uuml;/ü_.ü Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 xayü => xayü Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 asdasd/ü.mp3 => asdasd/ü.mp3 Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 ü. => ü. Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 blahahbasdü => blahahbasdü Warning: Use of undefined constant searchTerm2 - assumed 'searchTerm2' (this will throw an Error in a future version of PHP) in /in/ZaQlI on line 8 1234ü1234 => 1234ü1234
Output for 4.3.0 - 7.1.10
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