PHP Programing language

array_search() Function in PHP
Previous Home Next

array_search()

The array_search() function search an array for a value and returns the key.

Syntax:
array_search(value,array,strict)

In above syntax, "value" specifies the value to search for, "array" specifies the array to search in, and "strict" If this parameter is set to TRUE, then this function will search for identical elements in the array and values are as follows:

  • true
  • false - Default

Example:

<?php
$a=array("a"=>"Apple","b"=>"Mango","c"=>"Banana");
echo array_search("Mango",$a);
?>

Output:

b

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: