Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Re: a performance question [RSS Feed]

#1 Nov. 17, 2005 09:14:35

Ants A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: a performance question


I'd say if anybody should know this for certain, it's somebody whobothers 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 myquestion here. I'm curious if type certainty requires an extra check, or acheck 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

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Re: a performance question [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support