I have this array:
$items = [
'Mac' => [
'quantity' => $qty1,
'price' => 1899.99
],
'Razer Mouse' => [
'quantity' => $qty2,
'price' => 79.99
],
'WD HDD' => [
'quantity' => $qty3,
'price' => 179.99
],
'Nexus' => [
'quantity' => $qty4,
'price' => 249.99
],
'Drums' => [
'quantity' => $qty5,
'price' => 119.99
]
];
And I am wanting to only select qty1 and or 1899.99 at times, and other times I want to access any of other qty's and or their associated prices.
Right now I am trying:
<?php foreach($items['Mac'] as $x => $x_value): ?>
<p><?= $x_value ?></p>
<?php endforeach ?>
which outputs:
1
1899.99
Above the 1 is the quantity of Mac's, and 1899.99 is the individual price, however I only want the quantity printed, not both.
How would I do this?