PHP strip_whitespace() 函數
定義和用法
strip_whitespace() 函數返回已刪除 PHP 注釋以及空白字符的源代碼文件。
該函數對于檢測腳本中的實際代碼量很有用。
語法
strip_whitespace(filename)
參數 | 描述 |
---|---|
filename | 必需。規定文件名。 |
說明
若成功,則返回被剝離的源代碼,若失敗,則返回空字符串。
注釋:在 PHP 5.0.1,該函數的行為與上面的描述一致。在這之前,它僅返回空字符串。
實例
"test.php":
<?php // PHP comment /* * Another PHP comment */ echo php_strip_whitespace ("test.php"); ?>
輸出:
<?php echo php_strip_whitespace ("test.php"); ?>