在 PHP 中比较字符串时忽略区分大小写
2022-08-30 10:09:26
我试图比较平等的单词,而[上下]的情况是无关紧要的。然而,PHP似乎不同意!关于如何强迫PHP在比较单词时忽略单词的大小写的任何想法?
$arr_query_words = ["hat","Cat","sAt","maT"];
for( $j= 0; $j < count($arr_query_words); $j++ ){
$story_body = str_replace(
$arr_query_words[ $j ],
'<span style=" background-color:yellow; ">' . $arr_query_words[ $j ] . '</span>',
$story_body
);
}
即使情况不同,有没有办法进行更换?