3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foods = array( 'meat' => array('burgers', 'steak', 'sausages', 'kebabs'), 'cake' => array('victorian', 'chocolate', 'fruit', 'fudge'), ); function getMeat(array $foods) { if (!isset($foods['meat']) { throw new Exception('There is no meat in this pie'); } $meatCount = count($foods['meats']); if($meatCount < 1) { throw new Exception('Where did all the meat go!?'); } var_dump($foods); $i = 0; $j = 1; while($i < $meatCount) { if ($foods['meats'][$i] < $foods['meats'][$j]) { $tempMeat = $foods['meats'][$i]; $foods['meats'][$i] = $foods['meats'][$j]; $foods['meats'][$j] = $tempMeat; } $i++; $j++; } var_dump($foods); }
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '{' in /in/5KG6n on line 10
Process exited with code 255.

preferences:
183.55 ms | 1387 KiB | 55 Q