我的数组结果是
Array ( [list] => Bhubaneswar,Cuttack,Angul,Sambalapur )
我想比较这个PHP数组,在列表中是congaing" Bhubaneswar'不是吗?
答案 0 :(得分:0)
答案 1 :(得分:-1)
试试这个:
$your_array = array(
"list" => 'Bhubaneswar,Cuttack,Angul,Sambalapur',
);
$mystring = $your_array['list'];
$findme = 'Bhubaneswar';
if(strpos($mystring, $findme) !== false){
echo "found";
}
OR
$search = preg_quote('Bhubaneswar', '~'); // don't forget to quote input string!
$your_array = array(
"list" => 'Bhubaneswar,Cuttack,Angul,Sambalapur',
);
$result = preg_filter('~' . $search . '~', null, $your_array);
echo "<pre>";
print_r(array_keys($result));