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]?
if statement parameter for an array
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: if statement parameter for an array
Code: Select all
if ($EAN_list[0])
Code: Select all
if ($EAN_list[0] == true)
is $EAN_list an array? And does the first element of the array contain a non-zero value?
Re: if statement parameter for an array
Thank you very much!! 