How do I delete repeated values in an array and count their number of values

Asked

Viewed 64 times

-1

My question is very simple, as I do to delete repeated values of array, for example:

array = banana,morango,laranja,banana,maca

How do I delete, 1x to banana so that array stay:

array = banana,morango,laranja,maca

And finally, I would like to know what function counts the number of values that has a array?

  • http://answall.com/questions/62830/remover-valores-duplicados-em-array-multidimensional

1 answer

2

$unicos = array_unique($array);
$quantidade = count($unicos);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.