Home > Backend Development > PHP Problem > How to use php strip_whitespace function

How to use php strip_whitespace function

藏色散人
Release: 2023-02-22 19:52:01
Original
2534 people have browsed it

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

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)
Copy after login

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

If you select "View Source" in the browser window, it will look like this:

<?php
echo php_strip_whitespace ("test.php"); ?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template