2.str_word_count() 該函數(shù)必須要傳遞一個參數(shù),根據(jù)參數(shù)類型返回單詞的個數(shù)。如下面的所示:復制代碼 代碼如下: php $str = "How many words do I have echo str_word_count($str); //Outputs 6
7.php_strip_whitespace() 該函數(shù)可以返回已刪除PHP注釋以及空白字符的源代碼文件,這對實際代碼數(shù)量和注釋數(shù)量的對比很有用。 示例:復制代碼 代碼如下: php // PHP comment here /* * Another PHP comment */ echo php_strip_whitespace(__FILE__); // Newlines are considered whitespace, and are removed too: do_nothing();