array_search

It searches the array for a given value and returns the corresponding key if successful

Example

<?php
$array = array(0 => ‘PHP’, 1 => ‘ASP’, 2 => ‘JSP’, 3 => ‘JS’);
echo $key = array_search(‘PHP’, $array);
?>

Output

0