+ 1
Help me arrive at the output of this code guys. Am really lost. The output is 5,4
snippet? $x = array("aaa", " "; "ccc", "ddd", " "); $y = array_unique($x); echo count ($x). ",".count($y);
3 Réponses
0
$y => counts the unique elements of the array (there are two elements => " ", so unique are 4 elements). count ($x) => return the number of all elements in the array => there are 5 elements. Hope it helps you.
0
Thanks for that. I never really got to understand the array_unique function until now.
Problem solved.
0
Samuel Kinuthia , I'm glad to help 😉