INTDIV(3) 1 INTDIV(3)
intdiv - Integer division
SYNOPSIS
integer intdiv (integer $numerator, integer $divisor)
DESCRIPTION
Returns the integer division of $numerator by $divisor.
PARAMETERS
o $numerator
- Number to be divide.
o $divisor
- Number which divides the $numerator
RETURN VALUES
The integer division of $numerator by $divisor. If $divisor is zero, it throws an E_WARNING and returns FALSE. If the $numerator is
LONG_MIN (- PHP_INT_MAX - 1) and the $divisor is -1, it returns zero.
EXAMPLES
Example #1
intdiv(3) example
<?php
var_dump(intdiv(3, 2));
var_dump(intdiv(-3, 2));
var_dump(intdiv(3, -2));
var_dump(intdiv(-3, -2));
var_dump(intdiv(PHP_INT_MAX, PHP_INT_MAX));
var_dump(intdiv(-PHP_INT_MAX - 1, -PHP_INT_MAX - 1));
var_dump(intdiv(-PHP_INT_MAX - 1, -1));
var_dump(intdiv(1, 0));
?>
int(1)
int(-1)
int(-1)
int(1)
int(1)
int(1)
int(0)
Warning: intdiv(): Division by zero in %s on line 9
bool(false)
PHP Documentation Group INTDIV(3)