3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_to_address($context) { $array = explode(" ", $context); $array_reversed = array_reverse($array); $numKey = ""; $zipKey = ""; foreach($array_reversed as $k=>$str) { if($zipKey) { continue; } if(strlen($str)===5 && is_numeric($str)) { $zipKey = $k; } } $array_reversed = array_slice($array_reversed, $zipKey); $array = array_reverse($array_reversed); foreach($array as $k=>$str) { if($numKey) { continue; } if(strlen($str)>1 && strlen($str)<6 && is_numeric($str)) { $numKey = $k; } } $array = array_slice($array, $numKey); $string = implode(' ', $array); return $string; } echo str_to_address("Sally sells seashells at 452 Parks Way, Lemons, GA and loves it."); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: array_slice(): Argument #2 ($offset) must be of type int, string given in /in/BGjuS:13 Stack trace: #0 /in/BGjuS(13): array_slice(Array, '') #1 /in/BGjuS(26): str_to_address('Sally sells sea...') #2 {main} thrown in /in/BGjuS on line 13
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:
50.42 ms | 401 KiB | 8 Q