简体   繁体   中英

compare string in array php

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.....

You can use in_array :

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

Or you can even use array_search

在PHP中,您将使用array_search() ,但这看起来并不像PHP。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM