1. Grammar
intdiv(divident, divisor);
2. Example
<?php $a = 10; $b = 3; $c = $a/$b;//正常除法 print("$a/$b="."$c \n");//10/3=3.3333333333333 echo "<br>"; var_dump($c); //float(3.3333333333333) ?>
<?php $a = 10; $b = 3; $c = intdiv($a, $b); //使用intdiv()函数 print("$a/$b="."$c \n");//10/3=3 echo "<br>"; var_dump($c); // int(3) ?>
In fact, the function of this function is to round down, without rounding of.
Recommended: php video tutorial php tutorial
The above is the detailed content of How does PHP calculate integer division?. For more information, please follow other related articles on the PHP Chinese website!