Arrays
PHP arrays are ordered maps. Use [] for lists and "key" => value for associative arrays. count gives the size.
Example
$a = [10, 20];
$a[] = 30;
$u = ["name" => "Ada", "age" => 30];
echo count($a), " ", $u["name"], "\n";
print_r($a);Result
3 Ada
Array
(
[0] => 10
[1] => 20
[2] => 30
)Exercise
Add to the end.
$a = 5;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.