Re: [PHP] Taking the last word out of a string

2002-04-12 Thread Jason Wong
On Friday 12 April 2002 17:59, Gil Disatnik wrote: > 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 fi

Re: [PHP] Taking the last word out of a string

2002-04-12 Thread Richard Baskett
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 th