HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

intdiv

Description

The intdiv of Math for PHP integer division.

Syntax

intdiv(
    int $num1,
    int $num2
): int

Parameters

num1

The number to be divided.

num2

The number which divides num1.

Return

Returns the integer quotient of the division of num1 by num2.

Examples

1 · num1 · negative · num2 · negative

<?

$num1 = -3;
$num2 = -2;

$return = intdiv($num1, $num2);

echo $return;
1

2 · num1 · negative · num2 · positive

<?

$num1 = -3;
$num2 = 2;

$return = intdiv($num1, $num2);

echo $return;
-1

3 · num1 · positive · num2 · negative

<?

$num1 = 3;
$num2 = -2;

$return = intdiv($num1, $num2);

echo $return;
-1

4 · num1 · positive · num2 · positive

<?

$num1 = 3;
$num2 = 2;

$return = intdiv($num1, $num2);

echo $return;
1