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? Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.