Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

PHP key() Function

by
Category:php
php php array function
PHP key() Function

The key() function is used to get the index element of the current array position.

This function returns FALSE on error.

Returns the key of the array element that is currently being pointed to by the internal pointer

Parameter Description
array Required. Specifies the array to use

Syntax

key(array) 

Example

$people=array("James","Cooper","Samuel","Alex");
echo "key: " . key($people);

Output

key: 0

0 Comments


Html code work in comment box


Related Post