Showing posts with label PHP key. Show all posts
Showing posts with label PHP key. Show all posts

Thursday, 25 September 2014

key in PHP

PHP key() function is utilized to get the key from the present internal pointer position.
PHP key() function returns FALSE on error.

Syntax:

key(array)
array : Required. Specifies the array to use.

Example:

<?php
$daysarr = array( "Sunday","Monday","Tuesday","Wednesday","Thursday" );
echo "The key from the current position is : " . key($daysarr);
?>

O/P:

The key from the current position is : 0