Php removes spaces and comments from the code

Source: Internet
Author: User
No details, no space in the code, no comments * @ paramstring $ content Code content * @ returnstring * functionstrip_whitespace ($ content) {$ stripStr; analyze the php source code $ token=en_get_all ($ content); $ last_spacefalse; for ($ i0, $ jco

No details NONE/*** remove the blank and comments in the Code * @ param string $ content the code content * @ return string */function strip_whitespace ($ content) {$ stripStr = ''; // analyze the php source code $ tokens = token_get_all ($ content); $ last_space = false; for ($ I = 0, $ j = co

<无详细内容> <无>
/*** Remove blank spaces and comments in the Code * @ param string $ content the code content * @ return string */function strip_whitespace ($ content) {$ stripStr = ''; // analyze the php source code $ tokens = token_get_all ($ content); $ last_space = false; for ($ I = 0, $ j = count ($ tokens ); $ I <$ j; $ I ++) {if (is_string ($ tokens [$ I]) {$ last_space = false; $ stripStr. = $ tokens [$ I];} else {switch ($ tokens [$ I] [0]) {// filter various PHP comments case T_COMMENT: case T_DOC_COMMENT: bre Ak; // filter space case T_WHITESPACE: if (! $ Last_space) {$ stripStr. = ''; $ last_space = true;} break; case T_START_HEREDOC: $ stripStr. =" <
   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.