Take the 2-minute tour ×

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.

share|improve this question
Your assumption is right insofar as strict code (for some definition of “strict”) can be executed faster – see e.g. HipHop. But I think this isn’t done in the official PHP interpreter. Facebook however is working on a VM which does exactly that. –  Konrad Rudolph Dec 4 '12 at 14:42
Micro optimization is the root of all evil. However, the strict standards tell you, that you will probably have less problems on the long run. @KonradRudolph I guess he is talking about PHPs own E_STRICT-notices –  KingCrunch Dec 4 '12 at 14:42
@King Inappropriate quotes are the root of all evil. OP isn’t talking about unnecessary micro-optimisations. –  Konrad Rudolph Dec 4 '12 at 14:43
I agree that it is not micro-optimization. Respecting standards has one obvious effect: it doesn't flood your logs with unnecessary warnings and notices. –  iMat Dec 4 '12 at 14:44
@KonradRudolph a) It's not a cite from me and b) What tells you, that this are not "unnecessary micro-optimisations"? It seems, that you are talking from something quite different thing. –  KingCrunch Dec 4 '12 at 14:45
show 10 more comments

1 Answer

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.

share|improve this answer
+1 Exactly right, every error that would be generated (even if you have error_reporting(0)) has a negative impact on performance, because they are still generated even when not reported. This in turn causes extra execution steps to be carried out by the program. –  Leigh Dec 4 '12 at 15:22
add comment

Your Answer


