Bold search terms

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
When you search in a search engine, your search terms go bold...

I want every word in a string to be found in another string and turn bold.

$q is the query from a user (eg: football results)
$result[1][snippet] is the snippet of test associated with the first result (eg: The best type football is where the results are good.)

I want to output "The best type of football is where the results are good."

How can I do this?

Thanks
Tom

Done... thanks... -

I exploded the $q variable by " " (a space) and then did an eregi_replace on the snippet!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
How about this....

When you are echoing out the string do a str_replace that would have worked here also. Same technique differnt function.
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back