PHP/Arrays... i got this array:
$list = [1,6,3,5,null,4,4,7,1,2,null,8,3];
and i need to create a function that can remove all NULL's and sort the list in ascending order AND return only the 4 unique elements... how do i do this? Ideas?
Use built-in functions like array_filter, sort, and array_unique, array_slice.
$list = [...$values]; $list = array_filter($list); $list = sort($list); $list = array_unique($list);
Обсуждают сегодня