Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 83
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
 
 
Register now for full access!
Old 01-18-2009, 11:31 AM Re: str_replace case insensitive
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
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: 83
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.33499 seconds with 12 queries