3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Everything you enter here will be executed by our servers. Try it! $wineBuys = array ( [2013-09-12] => 20; [2013-09-13] => 10, [2013-09-14] => 49 ); $hamBuys = array ( [2013-09-12] => 1; [2013-09-13] => 16, [2013-09-14] => 2 ); $cheeseBuys = array ( [2013-09-12] => 5; [2013-09-13] => 6, [2013-09-14] => 12 ); $calcByDate = array(); foreach ($wineBuys as $key => $value) { if (! array_key_exists($key, $calcByDate)) { $calcByDate[$key] = array($wineBuys[$key]); } else { $calcByDate[$key][] = $wineBuys[$key]; } }
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected ';', expecting ')' in /in/imYXf on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[', expecting ')' in /in/imYXf on line 6
Process exited with code 255.