While loop - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: While loop (/showthread.php?tid=37107) |
While loop - El Forum - 12-28-2010 [eluser]Avril[/eluser] Hello, Is a while loop instead of a foreach loop possible in CI? Thanks While loop - El Forum - 12-28-2010 [eluser]smilie[/eluser] w00t, not sure what your question is But, while and foreach are both PHP functions which have nothing to do with CI itself So, yes - they are both possible Cheers, Smilie While loop - El Forum - 12-28-2010 [eluser]Federico BaƱa[/eluser] I guess you can only use a while on an array with numeric keys, foreach can be used for associative arrays as well as the others. Code: foreach ($arr as $key => $val) |