Function Reference: geodir_remove_last_word
Summary
Removes the last word from the text.
Package
GeoDirectory
Parameters
- $text
- (string) (required) The input text.
- Default: None
Return Values
- (string)
Change Log
Since: 1.6.16
Source File
geodir_remove_last_word() is located in geodirectory-functions/helper_functions.php [Line: 964]
Source Code
function geodir_remove_last_word($text) { $spacepos = geodir_utf8_strrpos($text, ' '); if ($spacepos !== false) { $lastWord = geodir_utf8_strrpos($text, $spacepos); // Some languages are written without word separation. // We recognize a string as a word if it does not contain any full-width characters. if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) { $text = geodir_utf8_substr($text, 0, $spacepos); } return $text; } return ''; }