I have a nested array and I was wondering how can I look for an element in it.
Here is the array:
$test = [
['item_id' => 780, 'quantity' => 1],
['item_id' => 759, 'quantity' => 3],
['item_id' => 453, 'quantity' => 12]
];
I did manage to use a foreaech
loop but was wondering if there is a better approach?
foreach($test as $t) {
if($t['item_id']==780) echo $t['quantity'];
}