PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Im trying to highlight search keywords but str_replace is case sensitive
$row['Info'] contains "Park" and on searching park I want it to return this too. But I want the text display exactly as it was in the db,
still replaces the uppercase to lower in the replacement part.
I searched for park and there were 2 results. One has 'park' while the other has 'Park'. Obviously both must show up. But when displaying back for highlighting they should contain the original text - 'park' and 'Park'. But 'Park' gets converted to 'park'
the ereg_* functions work nearly the same, I just prefer using the preg functions, as most of the controls are all in the regex string, instead of a mix between there and the function name and other things..
he was already using strtolower in his original post, and as he said, it didn't work the way he'd like it.. and I'd have to agree and the use of strtolower is nearly useless, because of the added work you'll need to do to get the original text to be highlighted, instead of it being replaces entirely by lowercased text..