The strip_whitespace() function returns the source code of the specified file with PHP comments and whitespace removed.
string php_strip_whitespace ( string $filename )
Returns the PHP source code in filename with PHP comments and whitespace removed. This may be useful for determining the amount of actual code in your scripts compared with the amount of comments. This is similar to using php -w from the commandline.
The above example will output : -
<?php
echo php_strip_whitespace ("test.php"); ?>
Notice the PHP comments are gone, as are the whitespace and newline after the first echo statement.
Parameter | Description |
---|---|
filename | Required. Specifies the file to strip |
The stripped source code will be returned on success, or an empty string on failure. Note: This function only returns an empty string on versions before PHP 5.0.1.