PHP - 字串單詞計數函式



語法

mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )

定義和用法

它返回有關字串中使用的單詞的資訊

返回值

它返回陣列或整數。

引數

序號 引數和說明
1

字串

它指定要檢查的字串

2

返回

它指定字串的返回值

3

字元

它指定哪些字元被視為單詞

示例

嘗試以下示例

<?php
   echo str_word_count("tutorials point simply easy learning");
?>

這將產生以下結果 -

5
php_function_reference.htm
廣告