I don’t think what to add to this code so that it works on the output of only unique values (ie 3, 0)
<?php $arr = array(2, 5, 5, 3, 2, 10, 10, 0); for ($i = 0; $i < count($arr); $i++ ) { $a = true; for($j = 0; $j < $i; $j++){ if($arr[$i] == $arr[$j]){ $a = false; } } if($a){ echo $arr[$i]. " "; } } ?> And now all elements are displayed in the singular (ie, 2, 5, 3, 10, 0)