if statement parameter for an array
Posted: Tue Dec 22, 2009 5:08 pm
The following code is working on our website:
$EAN_List = (array)$parsed_xml->Items->Item->ItemAttributes->EAN;
if (is_array($EAN_List) and $EAN_List[0])
{ foreach ($EAN_List as $i=>$Item_Data)
{ echo $Item_Data; }
}
What does the $EAN_List[0] parameter do? Why could I not just check to see if it is an array and not include the $EAN_List[0]?
$EAN_List = (array)$parsed_xml->Items->Item->ItemAttributes->EAN;
if (is_array($EAN_List) and $EAN_List[0])
{ foreach ($EAN_List as $i=>$Item_Data)
{ echo $Item_Data; }
}
What does the $EAN_List[0] parameter do? Why could I not just check to see if it is an array and not include the $EAN_List[0]?