3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $searchfor in /in/Prsah on line 6 Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in /in/Prsah on line 6 Fatal error: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string in /in/Prsah:6 Stack trace: #0 /in/Prsah(6): str_replace('', Array, 'Animal crackers...') #1 /in/Prsah(13): replacelist('Animal crackers...') #2 {main} thrown in /in/Prsah on line 6
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
66.66 ms | 402 KiB | 8 Q