PHP Tutorial PHP Advanced PHP Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

PHP - Math intdiv() Function



The PHP Math 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 example below, intdiv() function returns 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

5