list is a language construct which is used to assign array items to variables.
Example:
PHP Code:
list($name, $age) = array('Tim', 105);
each returns an array with the key and value of the current array element, then advances the array pointer.
Example:
PHP Code:
$array = array('name' => 'Tim', 'age' => 105);
var_dump(each($array)); //0 => name, 1 => Tim
var_dump(each($array)); //0 => age, 1 => 105
var_dump(each($array)); //false
When it reaches the end, it returns false. So when used in a while loop, it loops through the array (starting at where the pointer is) and stops when it gets to the end.
Bookmarks