How to search the key values in the array – array_search

By | May 13, 2015

Notice: A non well formed numeric value encountered in /home/cinemau0/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

 

In the Given example, we have to find whether  “CSS” Find or not in the array. It prints the key of the value.

Output

b   // output

Explaination

array_search is used to search the array value(‘css’) and returns the value’s key(‘b’);

2. In_array()

In_array is simillar to the array_search

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

you can search anything value or key using IN_ARRAY();

for example

have to find “Developerdesks” in the given array

 

You can see explanation in this url