Jump to content

Archived

This topic is now archived and is closed to further replies.

realjumper

Character count

Recommended Posts

Hmmm...seems my post got lost....sorry...here it is....


Hi,

I have several sentences in my db (in the 'sentence' field) and I want to display an entire sentence. So far so good. I also have a field "Start" and a field "Finish". In the following sentence...'the quick brown fox jumps over the lazy dog'...I wish to display the part on the sentence that corresponds to the reurned "Start" and "Finish" numbers. So, in the above sentence, the number 5 is returned from the "Start" field and the number 9 is returned from the "Finish" field. What I wish to display is.....'the quick brown fox jumps over the lazy dog' and 'quick'. Is this possible? If it is, could someone point me in the right direction please?

Many Thanks,
Neil

Share this post


Link to post
Share on other sites
never mind.....I have it figured out by using substr(). The next problem is going to be making a formula to suit the 2 byte Japanese character set...but that's another story!!!

Thanks.

Neil

Share this post


Link to post
Share on other sites
Use the substr function:

[code]
$start = 5;
$end = 9;

$str = "the quick brown fox jumps over the lazy dog";
echo $str . "<br />";
echo substr($str, $start, ($end - $start));[/code]

Share this post


Link to post
Share on other sites

×

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.