PHP php_strip_whitespace()Functions

PHP Misc 参考手册PHP Misc Reference Manual

Examples

Returns the source code of "test.php" with PHP comments and whitespace 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");
?>


Definition and Usage

The php_strip_whitespace() function returns the source code with PHP comments and whitespace removed.


Syntax

php_strip_whitespace(filename)

Parameter Description
filename Required. Specifies the file name.

Technical Details

Return value: Returns the source code with PHP comments and whitespace removed if successful, or an empty string on failure.Notes:Before PHP 5.0.1, this function only returned an empty string.
PHP version: 5+


PHP Misc 参考手册PHP Misc Reference Manual Other extensions