Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 799
3Nex Avatar asked Dec 04 '12 14:12

3Nex


1 Answers

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).

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.

Regardless though, using E_STRICT is a smart idea and allows for more portable, future-proof code. However, I would not use performance as a valid reason to start writing strict PHP code.

like image 76
Evert Avatar answered Sep 28 '22 02:09

Evert