Search Results from an array by search the keyword in php -


i have array

array (      [4621] => hall enstein      [4622] => function areas      [4623] => dining areas      [4624] => events      [4625] => galleries      [4626] => custom pages      [4627] => news      [4629] => promotions ); 

how result [4622] => function areas search keyword f or fu. use array_intersect() function requirment. here have search keyword "function areas", not f or fu. f or fu, search result [4622] => function areas not coming. if 1 know it, please me. thank you

you use array_filter() filter array:

$output = array_filter($yourarray, function($v) {    return stristr($v, 'fu');  }); 

would output:

array   4622 => string 'function areas' (length=14) 

Comments