Javatpoint Logo
Javatpoint Logo

PHP intdiv() Function

The intdiv() is PHP mathematical function of PHP, which is used to calculate integer division. It returns the integer quotient of the division of dividend by divisor.

Syntax:

Parameter Description Required/Optional
Dividend number to be divided Required
Divisor Number divides the dividend Required

Example 1

Output:

Your Number is : (3,2)
int(1) : is Output value

Example 2

Output:

Your Number is : (-3,2)
int(-1) : is Output value

Example 3

Output:

Your Number is : (3,-2)
int(-1) : is Output value

Example 4

Output:

Your Number is : (-3,-2)
int(1) : is Output value

Example 5

Output:

Your given value is : (PHP_INT_MAX, PHP_INT_MAX)
int(1) : is your Output value

Example 6

Output:

Your given value is : (PHP_INT_MIN, PHP_INT_MIN)
int(1) : is your Output value

Example 7

Output:

Your given value is : (PHP_INT_MIN, -1)
 Fatal error: Uncaught ArithmeticError: Division of PHP_INT_MIN by -1 is not an integer

Example 8

Output:

Your given value is : (1,0)
Fatal error: Uncaught DivisionByZeroError: Division by zero

Next TopicPHP Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA