Phpifor Efficiency in PHP if and or operating efficiency comparison
The examples in this article describe the efficiency comparison between if and or in PHP. Share to everyone for your reference. The implementation method is as follows:
The operating efficiency of if and or is illustrated, and interested friends can test, here I test the result is or more than if efficiency is higher, oh, the specific code is as follows:
Copy the Code code as follows: <?php
$t 1 = microtime ();
while ($i <=10000) {
if (!defined (' App_path ')); 0.011059
Defined (' App_path ') or 1; 0.009398
$i + +;
}
$t 2 = Microtime ();
echo $t 2-$t 1;
?>
Example 2:
Copy the Code code as follows: <?php
$t 1 = microtime ();
while ($i <=1000000) {
if (!defined (' App_path ')); 0.20043
Defined (' App_path ') or 1; 0.107475
$i + +;
}
$t 2 = Microtime ();
echo $t 2-$t 1;
?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/926872.html www.bkjia.com true http://www.bkjia.com/PHPjc/926872.html techarticle if and or run efficiency comparison in PHP, phpifor efficiency The example in this paper describes the efficiency comparison between if and or in PHP. Share to everyone for your reference. Here's how to do it: run on if and or ...