Revision: 12603
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 20, 2009 10:38 by fischkopp
Initial Code
/*------------------------------------------------------------------- /* Submodul: last_word() /* Version: 1.0 /* Beschr.: Gibt das letzte Wort eines Strings zurück /* IN: string /* OUT: wort (letztes Wort aus String) /*------------------------------------------------------------------- */ function last_word($string) { if ( strrpos($string, " ") ) { $letztes_wort_anfang = strrpos($string, " ") + 1; $laenge_letztes_wort = strlen($string) - $letztes_wort_anfang; $letztes_wort = substr($string, $letztes_wort_anfang, $laenge_letztes_wort); return $letztes_wort; } else return $string; }
Initial URL
Initial Description
Returns last word of a string (words separated by blanks). if string does not have any blanks, it will return the whole string.
Initial Title
Find last word of a string
Initial Tags
function
Initial Language
PHP