PHP Associative Arrays

Associative arrays are arrays that use named keys that you assign to them. They provide a way to store data in key-value pairs.

Example of Associative Arrays

<?php
$person = array("name" => "John", "age" => 30);
echo $person['name']; // Outputs: John
?>

Output:

John

Explanation: This example demonstrates how to access an item in an associative array using its string key.