src/Str.php
public function count($substring = null) {
		if ($substring === null) {
			return mb_strlen($this->rawString, $this->charset);
		}
		else {
			return mb_substr_count($this->rawString, $substring, $this->charset);
		}
	}
public function count($substring = null) {
		if ($substring === null) {
			return mb_strlen($this->rawString, $this->charset);
		}
		else {
			return mb_substr_count($this->rawString, $substring, $this->charset);
		}
	}
public function count ( $ substring = null ) { if ( $ substring === null ) { return mb_strlen ( $ this -> rawString , $ this -> charset ) ; } else { return mb_substr_count ( $ this -> rawString , $ substring , $ this -> charset ) ; } }
Counts the occurrences of the specified substring in this string

@param string $substring the substring whose occurrences to count
@return int the number of occurrences
Counts the occurrences of the specified substring in this string