Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Bold search terms

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
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
•••
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
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back