3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function replacelist($thetext) { $seachfor = array("crackers","soup"); $replacewith = array("shapes","stew"); $newtext = str_replace($searchfor, $replacewith, $thetext); return $newtext." - plus some test text"; } $mytext="Animal crackers in my soup"; $newphrase = replacelist($mytext); echo $newphrase;
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: searchfor in /in/Prsah on line 6 Notice: Array to string conversion in /in/Prsah on line 6 Animal crackers in my soup - plus some test text
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: searchfor in /in/Prsah on line 6 Notice: Array to string conversion in /in/Prsah on line 6 Notice: Array to string conversion in /in/Prsah on line 6 Animal crackers in my soup - plus some test text
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: searchfor in /in/Prsah on line 6 Notice: Array to string conversion in /in/Prsah on line 6 Animal crackers in my soup - plus some test text