<?php function containsOnlyNull(array $array): bool { foreach ($array as $value) { if ($value !== null) { return false; } } return true; } echo 'a: ' . var_export(containsOnlyNull([null,null,null,null,null]), true); // 5 iterations for true outcome echo "\n"; echo 'b: ' . var_export(containsOnlyNull([null,null,1,null,null]), true); // 3 iterations for false outcome
You have javascript disabled. You will not be able to edit any code.