I donšt know of any function off the top of my head, but you could try doing an:
$array = explode(' ', $string); $lastword = array_pop($array); $string = implode(' ', $array); Now $string is equal to the original string without the last word. $lastword is equal to the lastword. It's possible there is an easier way of doing this, but this is what I came up with off the top of my head :) Rick "As I grow to understand life less and less, I learn to live it more and more." - Jules Renard > From: Gil Disatnik <[EMAIL PROTECTED]> > Date: Fri, 12 Apr 2002 11:59:13 +0200 > To: [EMAIL PROTECTED] > Subject: [PHP] Taking the last word out of a string > > Hello there, > I have a string that comes in various sizes and word numbers, I wish to > extract the last word from this string, how can I do it? > I have already looked at substr() and strrpos() man pages looking for the > answer... couldn't find it though... > > Thank you! > > > > Regards > > Gil Disatnik > Rockfour's webmaster > GibsonLP@EFnet > > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ > "Windows NT has detected mouse movement, you MUST restart > your computer before the new settings will take effect, [ OK ]" > -------------------------------------------------------------------- > Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating > system, written for a 4 bit processor by a 2 bit company which can > not stand 1 bit of competition. > -------------------------------------------------------------------- > www.technohac.com/webmaster - Homepage > -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php