How to remove only entirely duplicate values from an array?
<p>I have a website where my database is set up with different artists and song titles within the same row, where it might look this:</p>

<pre><code>artist: The Monkees, title: I'm A Believer
artist: The Monkees, title: Daydream Believer
artist: The Hollies, title: The Air That I Breathe
artist: The Hollies, title: Bus Stop
artist: The Beatles, title: Hello, Goodbye
artist: The Beatles, title: Yellow Submarine
</code></pre>

<p>And I have an autocomplete widget set up with my site's search form that is fed a json_encoded array filled with 'artist' values.</p>

<p>The first problem is that if a user were to begin typing "the" into the search form, values would come up like this:</p>

<p><b>The Monkees<br>
The Monkees<br>
The Hollies<br>
The Hollies<br>
The Beatles<br>
The Beatles</b> </p>

<p>So I used the array_unique function to remove duplicate values, but it seems that even if a value has one duplicate word (this case being "the"), it is removed entirely, so only the first value is returned:  </p>

<p><b>The Monkees</b></p>

<p>Where the output I would like to have would be:</p>

<p><b>The Monkees<br>
The Hollies<br>
The Beatles</b></p>

<p>So, what might be another way I can remove these duplicate values and display them the way I would like?</p>

<p>EDIT: </p>

<p>Here is my source code:</p>

<pre><code>&lt;?php

include 'includes/config.php';

$return_arr = array();
$term = ($_GET['term']);

if ($con)
{
$artist = mysql_query("SELECT * FROM songs WHERE artist LIKE '%$term%' LIMIT 0, 5");
while ($row = mysql_fetch_array($artist, MYSQL_ASSOC)) {

$row_array['value'] = strtolower($row['artist']);

array_push($return_arr,$row_array);
  }
}

mysql_close($con);

echo json_encode(array_unique($return_arr));
?&gt;
</code></pre>
