disbot4 Posted September 17, 2009 Share Posted September 17, 2009 Is it possible to leave out the first array key($myarray[0]) in a foreach loop? I basically just want the foreach loop to act on array keys 1-the total. Thanks, David Link to comment https://forums.phpfreaks.com/topic/174550-leave-out-first-array-item-in-foreach/ Share on other sites More sharing options...
khr2003 Posted September 17, 2009 Share Posted September 17, 2009 if the array is numeric you can add an if condition inside the foreach loop: foreach ($array as $key => $value) { if($key != $array[0]) { add your code here } } did not test but it should work (maybe with some modifications ) Link to comment https://forums.phpfreaks.com/topic/174550-leave-out-first-array-item-in-foreach/#findComment-919953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.