How can PHP be used to correctly access the values of price and quantity from the JSON file?
To access the values of price and quantity from the JSON file in PHP, you need to decode the JSON data using the json_decode() function and then access the values using the appropriate keys. You can access the price and quantity values by specifying the key names in the decoded JSON object.
<?php
$json_data = '{"product": "Apple", "price": 1.99, "quantity": 10}';
$data = json_decode($json_data, true);
$price = $data['price'];
$quantity = $data['quantity'];
echo "Price: $price<br>";
echo "Quantity: $quantity";
?>