Search an array with duplicate value for the value 5 and return its key in PHP

Description

The following code shows how to search an array with duplicate value for the value 5 and return its key.

Example


/*  www .  jav a  2 s. co m*/
<?php
    $a=array("a"=>"5","b"=>5,"c"=>"5");
    echo array_search(5,$a,true);
?>

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