단어를 비교하려고합니다. 위와 아래의 단어는 서로 관련이 없습니다. 그러나 PHP가 동의하지 않는 것 같습니다! PHP를 단어의 대소 문자를 무시하는 방법을 무시하는 방법에 대한 아이디어가 있습니까?PHP에서 문자열을 비교할 때 대/소문자 구분을 무시합니다.
$arr_query_words = array("hat","Cat","sAt","maT");
// for each element in $arr_query_words -
for($j= 0; $j < count($arr_query_words); $j++){
// Split the $query_string on "_" or "%" :
$story_body = str_replace($arr_query_words[ $j ],
'<span style=" background-color:yellow; ">' . $arr_query_words[ $j ] . '</span>',
$story_body);
// --- This ONLY replaces where the case [upper or lower] is identical ->
}
사례가 다른 경우에도 교체를 수행 할 수 있습니까?
내가 업데이트 한 거짓, true를 돌려 strcasecmp 경우에만 어떤 너는 물어 보려했다! –