$while1 = [
[
"id" => '1',
"amount" => '11',
],
[
"id" => '2',
"amount" => '12',
],
];
foreach ($while1 as $arrayStep1) {
foreach ($arrayStep1 as $arrayStep2 => $val) {
echo $arrayStep1[$arrayStep2].'<br>';
}
}
$while1 = [
[
"id" => '1',
"amount" => '11',
],
[
"id" => '2',
"amount" => '12',
],
];
foreach ($while1 as $subArray) {
foreach ($subArray as $key=>$value) {
if ($key == 'amount') {
echo $value."\n";
}
}
}
// OR
foreach ($while1 as $subArray) {
echo $subArray['amount']."\n";
}