PHP Create Associative Arrays
Syntax
An associative array in PHP is an array where each key is a string that maps to a specific value.
$arrayName = [ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];$arrayName = array( 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3');Example
// Declaring an associative array$person = ["name" => "John", "age" => 30, "city" => "New York"];
// Accessing elements by keyecho $person["name"]; // Outputs: John