drisate Posted September 5, 2008 Share Posted September 5, 2008 Hey guys. I am currently making a small seach script and i wanted to make the seach string red in the result so i did this: $ebook[name]=str_replace($_GET[q], "<font color='#FF0000'>$_GET[q]</font>", $ebook[name]); $ebook[description]=str_replace($_GET[q], "<font color='#FF0000'>$_GET[q]</font>", $ebook[description]); Works great. If you seach "hello" is will replace hello by a red hello. But i am experiencing a small bug with it ... if you type "Hello" and in the string theres "hello" it's not gona put it red because the cap makes it diffrent ... how can i solve that? Quote Link to comment Share on other sites More sharing options...
jordanwb Posted September 5, 2008 Share Posted September 5, 2008 str_ireplace - the case insensitive version of str_replace. Quote Link to comment Share on other sites More sharing options...
drisate Posted September 5, 2008 Author Share Posted September 5, 2008 haha i feel stupid lol thx bro works great now Quote Link to comment Share on other sites More sharing options...
jordanwb Posted September 5, 2008 Share Posted September 5, 2008 haha i feel stupid lol thanks bro works great now No problem, we all have those days. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted September 5, 2008 Share Posted September 5, 2008 Also, you're not using proper array syntax. Array keys should be enclosed in quotation marks (usually ' ', unless you need to use a variable). This also gives you (slightly) faster speeds. If you want me to explain why, just ask. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.