3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function wordScore($word){ $map = '^^abcdefghijklmnopqrstuvwxyz1234567890'; return array_reduce(str_split($word), function($score, $letter) use ($map) { echo stripos($map, $letter) . "\n" if (!$score) return stripos($map, $letter); return $score + stripos($map, $letter); }); } echo wordScore('suzuki') . "\n"; echo wordScore('sports'); exit;
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected 'if' (T_IF), expecting ',' or ';' in /in/rlTZT on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in /in/rlTZT on line 8
Process exited with code 255.