3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = [ ['l' => 1, 's' => 'a'], ['l' => 2, 's' => 'a'], ['l' => 3, 's' => 'b'], ]; $processed = []; foreach ($a as $v) { $processed[$v['s']][] = $v['l']; } $processed = array_map(function($v) {return implode(',', $v);}, $processed) print_r($processed);
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected 'print_r' (T_STRING) in /in/UIlT0 on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[' in /in/UIlT0 on line 4
Process exited with code 255.