简体   繁体   English

使用严格的标准,PHP执行速度更快吗?

[英]Is PHP execution any faster with strict standards?

I can't believe i'm not able to google anything relevant to this question, but anyway... 我无法相信我无法谷歌任何与此问题相关的内容,但无论如何......

My logical assumption would be that scripts which obey all the rules that strict standards dictate would execute faster. 我的逻辑假设是遵守严格标准规定的所有规则的脚本执行得更快。

On the other hand, if the scripts WORK without strict standards, then maybe strict standards is just an unnecessary extra verification step in the compiling process... 另一方面,如果脚本没有严格的标准,那么严格的标准可能只是编译过程中不必要的额外验证步骤......

Is there any official information on what's faster? 有什么更快的官方信息吗? Thanks. 谢谢。

It should be faster.. 它应该更快..

The simple reason being is that PHP's error triggering system is pretty heavy, and even if E_STRICT errors are suppressed, they still enter the error mechanism (only to be ignored). 原因很简单,PHP的错误触发系统非常繁重,即使E_STRICT错误被抑制,它们仍然会进入错误机制(只是被忽略)。

But in reality it highly depends on the situation, because I could imagine that working around E_STRICT could in itself also be heavier than the original solution. 但实际上它在很大程度上取决于具体情况,因为我可以想象,围绕E_STRICT工作本身也可能比原来的解决方案更重。

Regardless though, using E_STRICT is a smart idea and allows for more portable, future-proof code. 尽管如此,使用E_STRICT是一个聪明的想法,并允许更便携,面向未来的代码。 However, I would not use performance as a valid reason to start writing strict PHP code. 但是,我不会将性能作为开始编写严格PHP代码的正当理由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM