3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function splitStreetNameNumber($str) { $str = trim($str); if (0 >= strlen($str)) { return false; } $t = preg_split('/[0-9]+/', $str); if (isset($t[0]) && (!isset($t[1]) || trim($t[1]) == '')) { return array( 'name' => trim($t[0]), 'num' => 0, ); } else { $num = str_replace($t[0], '' $str); return array( 'name' => trim($t[0]), 'num' => trim($num), ); } } $a = array( 'Karlstr. 2', 'Karl Stra├če 2d', 'Karlsplatz 14 a', 'Karlsplatz', ); foreach($a as $b) { $c = splitStreetNameNumber($b); print_r($c); }
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '$str' (T_VARIABLE) in /in/oZQF3 on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/oZQF3 on line 16
Process exited with code 255.