Comparison of if and or operating efficiency in PHP, phpifor efficiency
The example in this article describes the comparison of the operating efficiency of if and or in PHP. Share it with everyone for your reference. The specific implementation method is as follows:
The operating efficiency of if and or is explained with examples. Interested friends can test it. The result of my test here is that or is more efficient than if. The specific code is as follows:
Copy code The code is as follows:
$t1 = microtime();
while($i<=10000){
If(!defined('APP_PATH')); // 0.011059
// defined('APP_PATH') OR 1; // 0.009398
$i++;
}
$t2 = microtime();
echo $t2 - $t1;
?>
Example 2:
Copy code The code is as follows:
$t1 = microtime();
while($i<=1000000){
If(!defined('APP_PATH')); //0.20043
// defined('APP_PATH') OR 1; //0.107475
$i++;
}
$t2 = microtime();
echo $t2 - $t1;
?>
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/926872.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/926872.htmlTechArticleComparison of the operating efficiency of if and or in PHP, phpifor efficiency This article describes the comparison of the operating efficiency of if and or in PHP. Share it with everyone for your reference. The specific implementation method is as follows: Running if and or...