I’m using array_unique to remove duplicates from an array, but even though the counter is right, and the number of the elements is right, some of its elements are displayed as undefined!
$varietals=array_unique($varietals1);
$countVarietals = count($varietals);
I’m listing results with jquery
var Varietal = data.Varietal;
var countVarietal = data.countVarietal;
// alert(countVarietal);
$("#selectVarietal").html("");
for(var i = 0; i < countVarietal; i++){
$("#selectVarietal").append("<label><input type='checkbox' class='wineTypeCheck' name='Varietal' value='"+Varietal[i]+"' />"+Varietal[i]+"</label><br />");
}
Anybody familiar with this?
thank u in advance!
thus I needed to add array_values(), in order to close the gap
source: http://php.net/manual/en/function.array-unique.php