Я просто пытаюсь сбросить массив в пределах foreach или нет; Кажется, я просто не понимаю, как получить ключи и использовать их для сброса нужных строк.
$people['Australian'][] = array('name' => 'Jack', 'cash' => 40800);
$people['Australian'][] = array('name' => 'Bob', 'cash' => 575000);
$people['Australian'][] = array('name' => 'Joey', 'cash' => 200);
$people['Australian'][] = array('name' => 'Max', 'cash' => 8000);
$people['Australian'][] = array('name' => 'Robert', 'cash' => 100000);
$people['Italian'][] = array('name' => 'Gregorio', 'cash' => 22000);
$people['Italian'][] = array('name' => 'Nicola', 'cash' => 4000);
$people['Italian'][] = array('name' => 'Melania', 'cash' => 6200);
$people['Italian'][] = array('name' => 'Filippa', 'cash' => 52500);
$people['Japanese'][] = array('name' => 'Optimus Prime', 'cash' => 57331);
foreach($people as $country)
{
foreach($country as $person)
{
if($person['cash']<50000)
{
//This seems to unset the variable used by the foreach loop.
unset($person);
}
}
}