3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function replacelist($thetext) { $searchfor = array("crackers","soup"); $replacewith = array("shapes","stew"); $newtext = str_replace($searchfor, $replacewith, $thetext); return $newtext." - plus some test text"; } ?> <?php $mytext="Animal crackers in my soup"; $newphrase = replacelist($mytext); echo $newphrase; ?>
Output for 4.3.0 - 7.1.0
Animal shapes in my stew - plus some test text