realjumper Posted March 13, 2006 Share Posted March 13, 2006 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 Link to comment https://forums.phpfreaks.com/topic/4872-character-count/ Share on other sites More sharing options...
realjumper Posted March 13, 2006 Author Share Posted March 13, 2006 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 Link to comment https://forums.phpfreaks.com/topic/4872-character-count/#findComment-17172 Share on other sites More sharing options...
hitman6003 Posted March 13, 2006 Share Posted March 13, 2006 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] Link to comment https://forums.phpfreaks.com/topic/4872-character-count/#findComment-17178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.