PHP Associative Arrays

A PHP array is an ordered map. With string keys it works as a dictionary: ["Ada" => 91] pairs the key with a value, and $scores["Linus"] = 79 adds one more entry at the end.

PHP
<?php
$scores = ["Ada" => 91, "Grace" => 88];
$scores["Linus"] = 79;
foreach ($scores as $name => $score) {
    echo "$name: $score\n";
}
echo count($scores), "\n";
Read the full lesson