Non voglio essere ostinata ma a me le chiavi in più non vengono eliminate.
Ecco la stampa dell'array
array(2) { [0]=> string(1) "1" [5]=> string(1) "2" } var_dumpArray

come vedi ho le chiavi [0] e [5] con i valori presi una sola volta.
Non mi spiego come mai.
Purtroppo devo creare un ciclo for fino alla lunghezza dell'array che nel mio caso risulta essere 2, in questo caso mi salta la chiave [5] ecco perchè cerco una soluzione.
Ho consultato il sito internet che mi hai gentilmente dato, in fondo alla pagina c'è lo stesso mio problema ma non mi pare abbiamo messo una soluzione.
in fonto si vede che se fa un ciclo fino al count(array) ossia 3, salta gli ultimi valori.
Posto la parte dell'articolo in inglese sperando che si possa risolvere il problema.
Grazie.

It seems that array_unique creates an exact copy of the original array and then elimitates duplicate values. It does NOT change the "internal references" of the array. For example:

<?php
$test_alfa = array();
$test_alfa[0] = "aa";
$test_alfa[1] = "aa";
$test_alfa[2] = "aa";
$test_alfa[3] = "bb";
$test_alfa[4] = "aa";
$test_alfa[5] = "bb";
$test_alfa[6] = "cc";
$test_alfa[7] = "bb";

$test_beta= array_unique($test_alfa);
$numValues = count($test_beta);
for ($i = 0 ; $i <= 7 ; $i++)
echo("test_beta[$i] = $test_beta[$i]
");
echo ("Number of elements in test_beta = $numValues ");
?>
will give you the following output:

test_beta[0] =
test_beta[1] = aa
test_beta[2] =
test_beta[3] =
test_beta[4] =
test_beta[5] = bb
test_beta[6] = cc
test_beta[7] =
Number of elements in test_beta = 3

The point is that you won't get the output you'd expect if you think that the values of the non duplicate elements are located in the first three array locations.

<?php
$numValues = count($test_beta);
for ($i=0;$i<=$numValues; $i++)
echo("test_beta[$i] = $test_beta[$i]
");
echo ("Number of elements in test_beta = $numValues ");
?>

will give you:

test_beta[0] =
test_beta[1] = aa
test_beta[2] =
Number of elements in test_beta = 3

Hope that saves u some debugging time!