src/Utility/Text.php
public static function numberOfWords($text) {
		$count = 0;
		$words = explode(' ', $text);
		foreach ($words as $word) {
			$word = trim($word);
			if (!empty($word)) {
				$count++;
			}
		}
		return $count;
	}
public static function numberOfWords($text) {
		$count = 0;
		$words = explode(' ', $text);
		foreach ($words as $word) {
			$word = trim($word);
			if (!empty($word)) {
				$count++;
			}
		}
		return $count;
	}
public static function numberOfWords ( $ text ) { $ count = 0 ; $ words = explode ( ' ' , $ text ) ; foreach ( $ words as $ word ) { $ word = trim ( $ word ) ; if ( ! empty ( $ word ) ) { $ count ++ ; } } return $ count ; }
Count words in a text.

//TODO use str_word_count() instead!!!

@param string $text
@return int
Count words in a text .