Skip to content
Advertisement

PHP: Delete unique values from an array

I would like to delete all unique values from an array.

So lets say I have $array = (1,2,3,5,4,3,4,5,234)

the function should delete all unique values and output:

JavaScript

I just thought of a solution with array_count_values but I do not know how I could iterate it. Furthermore I am sure there is a more elegant and efficient way to do this. Thank you for your help in advance.

Advertisement

Answer

One of solutions:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement