Fundamentals4 / 5
Up next

Arrays

<?php
$nums = [1, 2, 3, 4, 5, 6];
$evens = array_filter($nums, fn($n) => $n % 2 === 0);
echo array_sum($evens);
What you're solving

array_filter with an arrow fn