Adding the check after checking if the data is set would eliminate errors generated in the loop if it were not an array.
function addItem($_text="",$_value="",$_data=array(),$_selected=false,$_enabled=true)
{
$_item = new KoolComboboxItem();
$_item->enabled = (isset($_enabled))?$_enabled:false;
$_item->selected = (isset($_selected))?$_selected:false;
if($_text!="") $_item->data["text"] = $_text;
$_item->data["value"] = $_value;
if (isset($_data)&& is_array($_data) ) // check if $_data is an array Anthony
{
foreach($_data as $_k=>$_v)
{
$_item->data[$_k] = $_v;
}
}
array_push($this->_items,$_item);
return $_item;
}