Reason for withdrawal $uniques-
Array
(
[0] => 1
[1] => 5
[2] => 2
[3] => 6
[4] => 3
[6] => 7
)
Your array does not contain a key 5, but the for echo $uniques[$i];value is not held in a loop echo $uniques[5];. this is the reason the value is missing 7.
Try it,
foreach($uniques as $unique){
echo $unique;
}
instead
for($i = 0; $i < count($uniques); $i++)
, array_values($uniques)
$uniques = array_values($uniques);
for($i = 0; $i < count($uniques); $i++)
echo $uniques[$i];