Return the element key from the current internal pointer position in PHP

Description

The following code shows how to return the element key from the current internal pointer position.

Example


  //from  w w  w.  j  a  va2 s. c om
<?php
    $people=array("XML","CSS","HTML","Javascript");
    echo "The key from the current position is: " . key($people);
?>

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