Jump to content

change the color of a word in a string


Go to solution Solved by cyberRobot,

Recommended Posts

Also, this isn't a free code forum. its a php help forum. If you need help with some code you are writing, then this place is perfect for you. However, if you want someone to give you code, there are plenty of forums for hiring freelance developers out there. I think there is even a subforum for that here.

  • Solution

i need to change the color of a word in a string where the word is unknown (from $_POST) and may have one or more uppercase chars. code please.

 

Are you looking to create a keyword highlighter like you find in search engines? If so, you could look into using something like str_ireplace(). More information can be found here:

http://php.net/manual/en/function.str-ireplace.php

 

Note that there's an example keyword highlighter in the user-contributed notes here

http://php.net/manual/en/function.str-ireplace.php#87417

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.