<?php $nums = [1, 2, 3, 4, 5, 6]; $evens = array_filter($nums, fn($n) => $n % 2 === 0); echo array_sum($evens);
array_filter with an arrow fn