AV1611 Posted December 27, 2006 Share Posted December 27, 2006 I have an array.I want to do an if clause on every item in it until it is done. then number of items varies.$i=0while(isset($arr[$i])){ if($arr[$i]==$whatever) {do whatever; $i++;} else {$i++;} }Is this the best way? Link to comment https://forums.phpfreaks.com/topic/31980-solved-looping-through-an-array/ Share on other sites More sharing options...
bljepp69 Posted December 27, 2006 Share Posted December 27, 2006 Use this method:[code]foreach ($arr AS $item) { //do whatever to $item}[/code] Link to comment https://forums.phpfreaks.com/topic/31980-solved-looping-through-an-array/#findComment-148425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.