How can arrays be used in PHP to store items and their corresponding prices?

To store items and their corresponding prices in PHP, you can use an associative array where the item names are the keys and the prices are the values. This allows you to easily access the price of an item by referencing its name in the array.

// Create an associative array to store items and their prices
$items = [
    'apple' => 0.99,
    'banana' => 0.59,
    'orange' => 0.79
];

// Access the price of an item
echo 'The price of an apple is $' . $items['apple'];