# PHP Intdiv () Function

| | | |
Syntax:
int intdiv (\$dividend, \$divisor)
Parameters: the function takes two parameters as follows:
• \$divnd: this signed integer parameter refers to the number to be separated.
• \$divisor: this signed integer parameter refers to to the number to be used as the divisor.
Return type : This function returns the calculated ratio.Examples:
Input: \$dividend = 5, \$divisor = 2 Output: 2 Input: \$dividend = -11, \$divisor = 2 Output: -5
Exception / Error::The function raises an exception in the following cases:
• If we pass the divisor 0, the function will throw a DivisionByZeroError.
• If we pass PHP_INT_MIN as the dividend and -1 as divisor, an ArithmeticError is thrown.
• The following program illustrates how intdiv works in PHP:
// PHP -code to illustrate the work
// intdiv() functions \$dividend = 19; \$divisor = 3; echo intdiv ( \$dividend , \$divisor );
?>
Output:
6
Looking so far, many might think this function is equivalent to
floor (\$dividend / \$divisor)
but an example will clarify the difference.
// PHP code to differentiate
// intdiv() and floor() \$dividend = -19; \$divisor = 3; echo intdiv ( \$dividend , \$divisor ). "" . floor ( \$dividend / \$divisor ) ;
?>
Output:
-6 - 7
Important points to pay attention to :
• The intdiv() function returns the quotient of an integer division.
• The function can throw exceptions, so the developer should tackle the edge cases.
• The function is not equivalent to the floor function applied to float division or "/".
http://php.net/manual/en/function.intdiv. php

## Shop

Best laptop for Fortnite

\$

Best laptop for Excel

\$

Best laptop for Solidworks

\$

Best laptop for Roblox

\$

Best computer for crypto mining

\$

Best laptop for Sims 4

\$

Best laptop for Zoom

\$499

Best laptop for Minecraft

\$590

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method