Skip to content
Quiz · Array functions · lesson 4 of 8

Quiz — filter and keys

Question 1 of 3

What does the program print?

PHP
<?php

$nums = [5, 8, 1, 6];
$even = array_filter($nums, fn($n) => $n % 2 === 0);
echo json_encode($even), ' ', json_encode(array_values($even)), "\n";