key

It fetches a key from an array

Example

<?php
$lan = array(1=>”PHP”,2=> “ASP”, 3=>”JSP”);
foreach($lan as $value)
if(“PHP”==$value)
echo key($lan);
?>

Output

2

Share