Reputation: 93
Im not able to retrieve all the data from this multidimensional array. I have coded using foreach loop but it shows error as the inner loop isnt working out fine.. Please help me.
This is the code I have tried
foreach($capture as $k) {
foreach($k['ReportLines'] as $detail){
echo $detail['Quantity'];
echo $k['Description'];
}
}
This is the array
$capture= Array
(
[ReportLines] =>
Array([0] =>
Array(
[Quantity] => 4.00
[Item] => MISPM
[Description] => Midnight
[Price] => 30.00
[Amount] => 120.00
)
[1] =>
Array(
[Quantity] => 40.00
[Item] => BMISPM
[Description] => Midnight2
[Price] => 340.00
[Amount] => 1220.00
)
[2] =>
Array(
[Quantity] => 24.00
[Item] => AMISPM
[Description] => Midnight3
[Price] => 3250.00
[Amount] => 1220.00
)
([3] =>
Array(
[Quantity] => 34.00
[Item] => MIeSPM
[Description] => Midnight
[Price] => 30.00
[Amount] => 120.00
)
)
)
Upvotes: 0
Views: 32
Reputation: 1801
Try this way:
foreach($capture['ReportLines'] as $detail) {
echo $detail['Quantity'];
echo $detail['Description'];
}
Sorry for fast response but i'm writing from phone.
I will edit the answer as soon as possible
Upvotes: 1