I'd say if anybody should know this for certain, it's somebody who bothers to benchmark it:

 $ time php -r '$s="abc";for($i=0;$i<10000000;++$i);'

real    0m1.966s
user    0m1.634s
sys     0m0.072s
 $ time php -r '$s="abc";for($i=0;$i<10000000;++$i) $s=="abc";'

real    0m3.974s
user    0m3.779s
sys     0m0.062s
 $ time php -r '$s="abc";for($i=0;$i<10000000;++$i) $s==="abc";'

real    0m2.510s
user    0m2.320s
sys     0m0.056s

Ants

Ron Korving wrote:
If anybody should know this for certain, it's core developers, hence my question here. I'm curious if type certainty requires an extra check, or a check less.

Which of these is faster?

if ($str === 'abc') { }
if ($str == 'abc') { }

I expect the triple '=' to be faster, but I'd like to be sure.

Thank you,

Ron

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to