Associative Array
An associative array is an incredible data structure that looks like dictionaries in Python and Javascript or maps in Java. It stores key-value pairs rather than just values. Their keys can access the values.
xxxxxxxxxx
18
<?php
//An associative array with employee names as keys and their ages as values
$employee_age = array(
"Rachel" => 22,
"Edward" => 23,
"Simon" => 24,
"Anna" => 25,
"Mike" => 26
);
//Output : 22
echo $employee_age["Rachel"];
//Output : 24
echo $employee_age["Simon"];
?>
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment