0

I have problem removing duplicate values from an array I have the following:

$input = explode(' ', $term_single->name);
$result = array_unique($input);
print_r($result);

I got the same value twice

Array ( [0] => QA )
Array ( [0] => QA )

What am I missing?

F_SO_K
  • 13,640
  • 5
  • 54
  • 83
Petrit
  • 39
  • 6

1 Answers1

0

Try to use like that.

<?php
$name = $term_single->name;
$input = explode(' ', $name);
$result = array_unique($input);
print_r($result);
?>
Su Yatanar
  • 173
  • 3
  • 13
  • Thats exactly the same as my questions, it will work if i marge the array **$input = array_merge($input , $name);** – Petrit May 21 '18 at 10:33