Run »
"; // The current element is Peter echo next($people) . "
"; // The next element of Peter is Joe echo current($people) . "
"; // Now the current element is Joe echo prev($people) . "
"; // The previous element of Joe is Peter echo end($people) . "
"; // The last element is Cleveland echo prev($people) . "
"; // The previous element of Cleveland is Glenn echo current($people) . "
"; // Now the current element is Glenn echo reset($people) . "
"; // Moves the internal pointer to the first element of the array, which is Peter echo next($people) . "
" . "
"; // The next element of Peter is Joe print_r (each($people)); // Returns the key and value of the current element (now Joe), and moves the internal pointer forward ?>
Peter
Joe
Joe
Peter
Cleveland
Glenn
Glenn
Peter
Joe
Array ( [1] => Joe [value] => Joe [0] => 1 [key] => 1 )