PHP strip_whitespace() 函数

定义和用法

The strip_whitespace() function returns the source code file with PHP comments and whitespace characters removed.

This function is very useful for detecting the actual code volume in scripts.

语法

strip_whitespace(filename)
参数 描述
filename 必需。规定文件名。

说明

If successful, it returns the stripped source code, if failed, it returns an empty string.

注释:In PHP 5.0.1, the behavior of this function is consistent with the above description. Before that, it only returned an empty string.

实例

"test.php":

<?php
// PHP comment
/*
*  Another PHP comment
*/
echo php_strip_whitespace      ("test.php");
?>

输出:

<?php
echo php_strip_whitespace ("test.php");
?>