tags:

views:

37

answers:

3

hi In php

a[]={'jeans','nishalli','baseses.','hude','htad','dfsdf','dfee','ddddd','ddfsa','fsadfa','dsfdasf','dfasdf','dsfdasf','dfdasf'};

i want to search the keyword = baseses

how to i can get the word baseses.

please help me.....

A: 

Try in_array()

http://php.net/manual/en/function.in-array.php

Ganesh Shankar
Doesn't return key, just a true/false if in array.
Xorlev
do they want a key?
Ganesh Shankar
A: 

In PHP you'd use array_search(), but that doesn't look like PHP.

Xorlev
+1  A: 

You can use in_array:

if (in_array('baseses', $a))
{
   echo 'So you found me !!';
}

Or you can even use array_search

Sarfraz