Home > Article > Backend Development > How to use php strip_whitespace function
php strip_whitespace function is used to return the source code file with PHP comments and blank characters removed. Its syntax is strip_whitespace(filename). The parameter filename is required and specifies the file name.
How to use php strip_whitespace function?
Definition and Usage
The strip_whitespace() function returns the source code file with PHP comments and whitespace characters removed.
Syntax
strip_whitespace(filename)
Parameters
filename required. Specifies the file name.
Return value:
If successful, it will return the source code with PHP comments and whitespace characters removed, if it fails, it will return empty. Note: In versions prior to PHP 5.0.1, this function simply returned the empty string.
PHP Version: 5
Example
Return the source code of the "test.php" file with the PHP comments and whitespace characters removed:
<?php // PHP comment /* * Another PHP comment */ echo php_strip_whitespace ("test.php"); ?>
If you select "View Source" in the browser window, it will look like this:
<?php echo php_strip_whitespace ("test.php"); ?>
The above is the detailed content of How to use php strip_whitespace function. For more information, please follow other related articles on the PHP Chinese website!