Php

How to search the key values in the array – array_search

Google+ Pinterest LinkedIn Tumblr

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

 

I'm Rajasekar - Web developer, Freelancer, Blogger and Owner of DeveloperDesks. From India lives in Bahrain. I love to do coding, Creating websites and trying different with code and designs. You Can Hire Me