> Include a space in your str_replace statement.
>
> For instance
>
> $t = str_replace(" $word ", " $word ", $text);
>
> That should prevent the problem your having and ensure only individual
> words
> are bolded.
Not the best solution if Merlin's code needs to account for the possibility
of ta
That's a good first step, but I think you're going to have to go with the regex
for this one. What happens if one of the words he wants to highlight is near
punctuation?
> $t = str_replace(" $word ", " $word ", $text);
This wouldn't work if you had:
$text = "I'm going to the store.";
$word =
Include a space in your str_replace statement.
For instance
$t = str_replace(" $word ", " $word ", $text);
That should prevent the problem your having and ensure only individual words
are bolded.
http://www.thelonecoder.com
[EMAIL PROTECTED]
562.924.4454 (office)
562.924.4075 (fax)
contin
Merlin wrote:
Hi there,
I am trying to mark words inside a sentence bold. Problem is, if there
is an overlap it does not work anymore.
I am using this code: $t = str_replace($word, "$word", $text);
For eample:
Mark those words bold: adventure in singapore
Text: My adventure flying to singapore
T
> I am trying to mark words inside a sentence bold. Problem is, if there is
> an
> overlap it does not work anymore.
> I am using this code: $t = str_replace($word, "$word", $text);
>
> For eample:
> Mark those words bold: adventure in singapore
> Text: My adventure flying to singapore
>
> The
Hi there,
I am trying to mark words inside a sentence bold. Problem is, if there is an
overlap it does not work anymore.
I am using this code: $t = str_replace($word, "$word", $text);
For eample:
Mark those words bold: adventure in singapore
Text: My adventure flying to singapore
The problem lay
6 matches
Mail list logo