从PHP中删除空格和换行符会使其运行更快吗? [英] Will removing white space and newline characters from PHP make it run faster?

查看:88
本文介绍了从PHP中删除空格和换行符会使其运行更快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题涉及性能,而不是文件大小.

This question refers to performance, not to file size.

我知道有用于javascript和css的最小"文件,但是如何优化PHP脚本呢?当然,您将希望保留人类可读格式的脚本副本.但是,对于在生产服务器上运行的版本,如果通过删除所有不必要的空格和换行符/制表符来优化",它的性能会更好吗?

I know there are "min" files for javascript and css, but what about optimizing PHP scripts. Of course you will want to keep a copy of the scripts in human readable format. However, for the version running on the production server, will it perform better if it is "optimized" by removing all of the unecessary space and newline / tab characters?

是否有任何基准?

推荐答案

已经在此处通过另一个问题讨论了一些问题,您可能需要看一下:

This has already been discussed some via another question here that you might want to look at: php source code whitespace

此外,尽管我从未亲自使用过它,但似乎有一条命令"php -w"会在您想走那条路的时候为您删除所有空格和注释.

Also, while I've never personally made use of it, there appears to be a command "php -w" which removes all whitespace and comments for you, should you want to go that route.

这篇关于从PHP中删除空格和换行符会使其运行更快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆