Mathematische Funktionen
PHP Manual

intdiv

(PHP 7)

intdivInteger division

Beschreibung

integer intdiv ( integer $numerator , integer $divisor )

Returns the integer division of numerator by divisor.

Parameter-Liste

numerator

Number to be divide.

divisor

Number which divides the numerator

Rückgabewerte

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.

Beispiele

Beispiel #1 intdiv() example

<?php
var_dump
(intdiv(32));
var_dump(intdiv(-32));
var_dump(intdiv(3, -2));
var_dump(intdiv(-3, -2));
var_dump(intdiv(PHP_INT_MAXPHP_INT_MAX));
var_dump(intdiv(-PHP_INT_MAX 1, -PHP_INT_MAX 1));
var_dump(intdiv(-PHP_INT_MAX 1, -1));
var_dump(intdiv(10));
?>
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)


Mathematische Funktionen
PHP Manual