php_strip_whitespace
Return the PHP source code after deleting comments and spaces
strip_whitespace()
function returns the source code file with deleted PHP comments and whitespace characters.
This function is useful for detecting the actual amount of code in a script.
After removing PHP comments and blanks, return the source code of the "test.php" file:
<?php // PHP Comments /* * Another PHP comment*/ echo php_strip_whitespace ( "test.php" ) ; ?>
Output:
<?php echo php_strip_whitespace ( "test.php" ) ; ?>
strip_whitespace ( filename )
parameter | describe |
---|---|
filename | Required. Specifies the file to be processed. |
If successful, the stripped source code is returned, and if it fails, the empty string is returned.
Note: In PHP 5.0.1, the behavior of this function is consistent with the description above. Before this, it only returns an empty string.