How to Add an Item to an Associative Array in PHP
In this lesson, we will see how to add an item to an associative array in PHP, an Associative array is an array that uses a named key that you assign to a value.
Add item to the associative array
The example below shows how you can add an item to an associative array in PHP.
$notes = array("jack" => 12, "john" => 15, "sam" => 4);
$notes += ["bob" => 5];
echo $notes["bob"];
//5