0

I have an array with these values.

$MyArray = array('2','4','4','4','2','2','0','0','0','0','4');

I want do an "array group by" (like in MySql) to only have one occurence of values. I expect something like this

$AnotherArray = array('2','4','0');

1 Answers1

1

you need to used array_unique function like this

$arrayData=array_unique($MyArray);

Here you can see your desired output

for more details about array_unique PHP Manual

Bilal Ahmed
  • 3,889
  • 3
  • 21
  • 40