intdiv

Integer division

Syntax

intdiv ( int $dividend , int $divisor ) : int

Parameters

dividend

Number to be divided.

divisor

Number which divides the dividend.

Return

The integer quotient of the division of dividend by divisor.

Examples

1

<?

$dividend = -3;
$divisor = -2;

$return = intdiv($dividend, $divisor);

echo $return;

?>
1

2

<?

$dividend = -3;
$divisor = 2;

$return = intdiv($dividend, $divisor);

echo $return;

?>
-1

3

<?

$dividend = 3;
$divisor = -2;

$return = intdiv($dividend, $divisor);

echo $return;

?>
-1

4

<?

$dividend = 3;
$divisor = 2;

$return = intdiv($dividend, $divisor);

echo $return;

?>
1

PHP

Home Menu