3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function splitStreetNameNumber($str) { $str = trim($str); $t = @preg_split('/[0-9]+/', $str); (0 >= strlen($str) || 0 >= strlen(trim($t[0]))) && return false; return array( 'name' => trim($t[0]), 'num' => trim(str_replace(trim($t[0]), '', $str)), ); } $a = array( 'Karlstr. 2', '12345', 'Karl Stra├če 2d', 'Karlsplatz 14 a', '', 'Karlsplatz', ); foreach($a as $b) { $c = splitStreetNameNumber($b); if (!$c) { echo "Not a valid address.\r\n"; } else { print_r($c); } }
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/Ope7s on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_RETURN in /in/Ope7s on line 7
Process exited with code 255.