Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
foreach loop work with collections without bothering about index of the element. It is best when elements in the collection have to be processed sequentially. foreach (item in collection ) { //to do } example <?php arr = {1,2,3,4,5,6,7,8,9} foreach (n in arr ) { echo n . "^2 = " . (n*n) . "<br>"; } ?>
22nd Mar 2017, 12:57 PM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar