Created
July 27, 2012 20:42
-
-
Save cspray/3190385 to your computer and use it in GitHub Desktop.
Say what...elseif versus else if
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$start = microtime(true); | |
for($i = 0; $i < 10000000; $i++) { | |
if(2 === 0) {} else if(2 === 1) {} else {} | |
} | |
$end = microtime(true); | |
echo "else if: ".($end - $start)."<br />"; | |
unset($start, $end); | |
$start = microtime(true); | |
for($i = 0; $i < 10000000; $i++) { | |
if(2 === 0) {} elseif(2 === 1) {} else {} | |
} | |
$end = microtime(true); | |
echo "elseif: ".($end - $start); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment