Current Location: Home> Function Categories> php_strip_whitespace

php_strip_whitespace

Return the PHP source code after deleting comments and spaces
Name:php_strip_whitespace
Category:Miscellaneous
Programming Language:php
One-line Description:Returns the source code of a file with PHP comments and spaces removed.

Definition and usage

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.

Example

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" ) ;
?>

grammar

 strip_whitespace ( filename )
parameter describe
filename Required. Specifies the file to be processed.

illustrate

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.

Similar Functions
Popular Articles