Home >>PHP Math Functions >PHP intdiv() Function

PHP intdiv() Function

PHP intdiv() Function

PHP intdiv() function is used for the integer division. It returns the integer quotient of the division of the given dividend and divisor passed as arguments. It accepts two arguments $dividend and $divisor. It ignores the remainder of the division and returns only the quotient.

Syntax:

  intdiv($dividend, $divisor);

Parameter Values

Parameter Description
dividend This is a required parameter. This parameter defines the number that will be divided.
divisor This is a required parameter. This parameter defines the number to divide the dividend by.

Here is an example of intdiv() function in PHP:

<html>
<body>

<?php

echo intdiv(4, 2)."<br>";
echo intdiv(5, 2)."<br>";  // it ignores the remainder

?>

</body>
</html>
Output:
2
2

Here is an another example of intdiv() function in PHP:

<html>
<body>

<?php

echo intdiv(455, 3)."<br>";
echo intdiv(-7, -2)."<br>";
echo intdiv(-15, 3)."<br>";
echo intdiv(96.5, 7)."<br>";

?>

</body>
</html>
Output:
151
3
-5
13

No Sidebar ads