I am trying to compare words for equality, and the case [upper and lower] does not matter. However, PHP does not seem to agree! Any ideas on how to get PHP to ignore the case of words when comparing them?
$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 -> }
Is there a way to do a replacement, even if the case is different?
php
Donal.Lynch.Msc Oct 30 '09 at 16:22 2009-10-30 16:22
source share