Get the current element key and value, and move the internal pointer forward in PHP

Description

The following code shows how to get the current element key and value, and move the internal pointer forward.

Example


/*from  w w w .ja va  2 s .c  om*/

<?php
    $people = array("XML", "CSS", "HTML", "Java");

    reset($people);

    while (list($key, $val) = each($people)){
        echo "$key => $val<br>";
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone