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