Skip to content

Instantly share code, notes, and snippets.

@cspray
Created July 27, 2012 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cspray/3190385 to your computer and use it in GitHub Desktop.
Save cspray/3190385 to your computer and use it in GitHub Desktop.
Say what...elseif versus else if
<?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