Unique

Top  Previous  Next

unique($a)

 

This returns a new data parameter that contains the unique elements of $a.

 

If $a= "5, 6, 2, 8, 2, 6, 1, 7, 2, 2, 1, 5" unique($a) will contain "5, 6, 2, 8, 1, 7"

 

You will often combine unique with sort

 

sort(unique($a))

 

will return "1, 2, 5, 6, 7, 8"