Inspects a given string and returns useful details about it.
public static inspect ( string $str ) : array | ||
$str | string | The string to be inspected. |
return | array | An associative array containing the following items: - "length" : string length. - "kanji" : number of kanji within this string. - "hiragana" : number of hiragana within this string. - "katakana" : number of katakana within this string. |
public function testInspectMixedCharacters() { $result = Analyzer::inspect($this->mixCharacters); $this->assertSame(array('length' => 19, 'kanji' => 4, 'hiragana' => 5, 'katakana' => 3), $result); }