Using for each to loop through an array
By admin | December 16, 2007
Sometimes you need to loop through an for this the for each function is used for example.
$grade = array(“first_name” => “First Name”,
“middle_name” => “Middle Name”,
“last_name” => “Last Name”,
“phone” => “Phone”);
foreach($grade as $field => $gard)
{
echo ”
$gard The name of the array $field
“;
}
?>
Notice the variable $grade arrays starting from first_name is given to $field and then the array value is given to label
U can use this in many forms
Thanks
krates
Topics: PHP | Comments Off on Using for each to loop through an array
Related Links: