3v4l.org

run code in 300+ PHP versions simultaneously
<?php $phrase = "You should eat fruuits, vegetaaables, and fiiibeeer every day."; $healthy = array("fruits", "vegetables", "fiber"); $patterns = array_map(function($term){ $newterm = ""; for($x=0; $x<strlen($term); $x++) $newterm.= preg_escape($term[$x], "~")."+"; return "~(".$newterm.")~"; }, $healthy); print_r($patterns); $yummy = array("pizza", "beer", "ice cream"); $newphrase = str_replace($healthy, $yummy, $phrase);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function preg_escape() in /in/cuiJ7:7 Stack trace: #0 [internal function]: {closure}('fruits') #1 /in/cuiJ7(5): array_map(Object(Closure), Array) #2 {main} thrown in /in/cuiJ7 on line 7
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:
59.88 ms | 401 KiB | 8 Q