fork download
  1. <?php
  2.  
  3. $array = [
  4. 'асд',
  5. 'садф',
  6. 'трытыу',
  7. 'чгчф',
  8. 'асд',
  9. 'трытыу',
  10. ];
  11. print_r($array);
  12.  
  13. $counter = array_count_values($array);
  14. for($i = 0, $size = count($array); $i < $size; ++$i) {
  15. if($counter[$array[$i]] > 1) {
  16. unset($array[$i]);
  17. }
  18. }
  19. print_r($array);
Success #stdin #stdout 0.02s 24520KB
stdin
Standard input is empty
stdout
Array
(
    [0] => асд
    [1] => садф
    [2] => трытыу
    [3] => чгчф
    [4] => асд
    [5] => трытыу
)
Array
(
    [1] => садф
    [3] => чгчф
)