Lesson content
Read, practise, then check your understanding
PHP arrays are ordered maps with integer or string keys. They can represent lists, dictionaries, and nested records, though arbitrary nested arrays provide weaker contracts than value objects.
Practical example
<?php
$scores = ['Mira' => 91, 'Ari' => 76];
$passing = array_filter($scores, fn(int $score): bool => $score >= 80);
$curved = array_map(fn(int $score): int => min(100, $score + 5), $scores);
Use array_key_exists when null still counts; isset returns false for null. Use strict in_array/array_search. Merge/spread and sorting functions treat keys differently, so select operations deliberately and document expected shapes.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.