etrader Posted February 10, 2011 Share Posted February 10, 2011 I have a foreach loop as foreach ($xml->channel->item as $value){ $title = $value->title; $text = $value->text; echo "$title <br /> $text"; } I want to skip any entry in which the title contains a character like ":" Link to comment https://forums.phpfreaks.com/topic/227304-skipping-an-entry-in-foreach/ Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 if (stristr($title, ':')) { continue; // go to next element } Link to comment https://forums.phpfreaks.com/topic/227304-skipping-an-entry-in-foreach/#findComment-1172469 Share on other sites More sharing options...
etrader Posted February 10, 2011 Author Share Posted February 10, 2011 Perfect solution! Thanks! Link to comment https://forums.phpfreaks.com/topic/227304-skipping-an-entry-in-foreach/#findComment-1172473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.