Monday, May 13, 2013

array_key_exists() 

function It is a array function which is used to check if the given key or index exists in the array.

To better understand the function let us see an example

$your_array = array("one" => 1, "two" => 4);
if (array_key_exists("one", $your_array)) {
      echo "The 'one' element is in the array";
 }

if the key exists in the array it will return true other wise it would return false

Use of  array_key_exists()

This function is widely use to save programmers time in search function.

 Most of the array function contain a wide range of argument which can be used to minimize source code.

2 comments: