remmingtonshowdown Posted February 20, 2009 Share Posted February 20, 2009 There ya go... Is there a method to make foreach() skip the first row? I'm running a csv but I want to skip the first row containing the headers... Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/146174-can-foreach-skip-first-row/ Share on other sites More sharing options...
premiso Posted February 20, 2009 Share Posted February 20, 2009 array_shift would "remove" the headers if that works. If not you can mvoe the internal array pointer with next to skip to the 2nd result. Quote Link to comment https://forums.phpfreaks.com/topic/146174-can-foreach-skip-first-row/#findComment-767425 Share on other sites More sharing options...
The Little Guy Posted February 20, 2009 Share Posted February 20, 2009 or... little longer... $i = 0; foreach($arr as $a){ if($i != 0){ echo $a.'<br />'; } $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/146174-can-foreach-skip-first-row/#findComment-767429 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.