foreach (PHP)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
foreach kalon nëpër çdo element të një array: foreach ($notat as $nota). Me foreach ($nxenesi as $celesi => $vlera) merr edhe çelësin, edhe vlerën.
EnglishEN
foreach goes through every item of an array: foreach ($grades as $grade). With foreach ($student as $key => $value) you get both the key and the value.
Si ta mendosh
Si mësuesja që thërret çdo emër në regjistër me radhë.
Lexoje në anglisht
Like a teacher calling every name in the register in turn.
Shembull kodiphp
<?php
$notat = ["Arta" => 5, "Dren" => 4];
foreach ($notat as $emri => $nota) {
echo "$emri: $nota<br>";
}