93 of 110 menu

PHP Identical or Duplicate Array Elements

To remove identical array elements, use the function array_unique. See the example:

<?php $arr = [1, 2, 2, 3, 4, 4]; $res = array_unique($arr); var_dump($res); ?>

Code execution result:

[1, 2, 3, 4]
English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline