basic difference between each and foreach is
each is iterate array for one element only and foreach is iterate array for all element .
either both each and foreach Return the current key and value pair from an array
$array = array(" i ","love","php");
$next = each($array);
print_r($next);
you cant use each like foreach
$array = array(" i ","love","php");
each($array as $key=>$value){
print_r($value);
}
because its not made for iterate the whole array next by next until loop disrupted
foreach loop
$array = array(" i ","love","php");
foreach($array as $key=>$value){
print_r($value);
}
its almost same like while loop , only foreach have key value return at every iteration