+ 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