TipGiver
Programmer
- Sep 1, 2005
- 1,863
Hi everyone.
I would like to get the 1st sentence of a variable. This php variable actually has html text saved in it. Previously i have use the combination of the functions strpos and substr to get the text untill the '.'
The problem with that is that if for example there is an image tag before the first real period, the image wont show.
$var = "Blah blah <img src=f1/f2/f3/image.gif/> blah blah."
The first period is the one at the image's name.
So the substr($var, 0, strpos($var, '.'))
will return "Blah blah <img src=f1/f2/f3/image"
and the image wont show (after echo-ing the var).
Can anyone help fix that?
I would like to get the 1st sentence of a variable. This php variable actually has html text saved in it. Previously i have use the combination of the functions strpos and substr to get the text untill the '.'
The problem with that is that if for example there is an image tag before the first real period, the image wont show.
$var = "Blah blah <img src=f1/f2/f3/image.gif/> blah blah."
The first period is the one at the image's name.
So the substr($var, 0, strpos($var, '.'))
will return "Blah blah <img src=f1/f2/f3/image"
and the image wont show (after echo-ing the var).
Can anyone help fix that?