PHP - intdiv() Function
The PHP intdiv() function is used for integer division and returns the integer quotient of the division of given dividend and divisor.
Syntax
intdiv(dividend, divisor)
Parameters
dividend |
Required. Specify the dividend. |
divisor |
Required. Specify the divisor. |
Return Value
Returns true the integer quotient of the division of given dividend and divisor.
Example:
In the below example, intdiv() function is used to return the integer quotient.
<?php echo intdiv(25.1, 2.49)."\n"; echo intdiv(34, 8)."\n"; echo intdiv(-34, -8)."\n"; echo intdiv(-34, 8)."\n"; echo intdiv(34, -8)."\n"; ?>
The output of the above code will be:
12 4 4 -4 -4
❮ PHP Math Functions