<?php
function getMeat($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);
}
$foods = array(
'meat' => array('burgers', 'steak', 'sausages', 'kebabs'),
'cake' => array('victorian', 'chocolate', 'fruit', 'fudge'),
);
getMeat($foods);
- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
- Parse error: syntax error, unexpected '{' in /in/m92OT on line 6
Process exited with code 255.
preferences:
190.55 ms | 1395 KiB | 55 Q