Reply
str_replace case insensitive
Old 01-18-2009, 11:19 AM str_replace case insensitive
Skilled Talker

Posts: 62
Trades: 0
Hi,

I want to use the following str_replace to highlight a searched term in a string.

PHP Code:
str_replace($zoek,'<span class="zoekhighlight">'.$zoek.'</span>',$zoekstring['content']) 
The problem is that i want this case insensitive. So when someone types 'kgk', i also want 'KGK' to be highlighted, and this does not happen with the above.

I have found a str_ireplace() function, but this will change my original 'KGK' into a highlighted 'kgk', but i would like to keep it uppercase in this case. Can this be done?

thanks!

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 01-18-2009, 11:31 AM Re: str_replace case insensitive
chrishirst's Avatar
Super Moderator

Posts: 22,260
Location: Blackpool. UK
Trades: 0
You could of course read the manual

http://us2.php.net/manual/en/functio...lace.php#86099
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-18-2009, 01:38 PM Re: str_replace case insensitive
Skilled Talker

Posts: 62
Trades: 0
yes i should do that more often, thanks.
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to str_replace case insensitive
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11489 seconds with 13 queries