Jump to content

[SOLVED] foreach check


ziarkaen

Recommended Posts

hi,

 

I'm analysing each "Item" part of an object created using "simplexml_load_file()" with a foreach loop, but I want to check at least one "Item" component exists before doing this.  Pseudo and real code follow:

 

$xml = simplexml_load_file($urlfile);
foreach($xml->SearchResult->ItemArray->Item as $item) {
    <<do stuff on $item>>
}

 

any help is......helpful lol

 

thanks

ben

Link to comment
https://forums.phpfreaks.com/topic/79845-solved-foreach-check/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.