I am using the following code :
<?php
$start_time = microtime(true);
for($i=1;$i <= 999999; $i++){
}
$end_time = microtime(true);
echo "Time Interval : ".$end_time-$start_time;
$start_time = microtime(true);
for($j=1;$j < 1000000; $j++){
}
$end_time = microtime(true);
echo "Time Interval : ".$end_time-$start_time;
?>
It shows met the time difference between them of 0.0943 seconds.So in this way <= operator is faster than ‘<‘. I just wanna know if there is any disadvantage of using <= operator over ‘<‘?
There is certainly no performance penalty. Both operands are single opcode in PHP bytecode, and ultimately both should be executed using exactly one CPU instruction.
http://www.php.net/manual/en/internals2.opcodes.is-smaller.php
http://www.php.net/manual/en/internals2.opcodes.is-smaller-or-equal.php
and of course I agree with comments – you should never optimize things at this low level of your code.