src/IntMath.php
/**
     * Returns the quotient of the arguments.
     *
     * The division rounds the result towards zero. Thus the absolute value of
     * the result is the largest possible integer that is less than or equal to
     * the absolute value of the quotient of the two operands. The result is
     * zero or positive when the two operands have the same sign and zero or
     * negative when the two operands have opposite signs.
     *
     * There is one special case that does not satisfy this rule: if the
     * dividend is the negative integer of largest possible magnitude for its
     * type, and the divisor is `-1`, then integer overflow occurs and the
     * result is equal to the dividend. Despite the overflow, no exception is
     * thrown in this case. On the other hand if the value of the divisor in an
     * integer division is `0`, then a `DivisionByZeroException` is thrown.
     *
     * @param integer $a The dividend.
     * @param integer $b The divisor.
     *
     * @return integer The quotient.
     *
     * @throws InvalidArgumentException If one of the arguments is not an
     *                                  integer.
     * @throws \DivisionByZeroError  If the divisor is zero.
     */
Returns the quotient of the arguments.
The division rounds the result towards zero. Thus the absolute value of
the result is the largest possible integer that is less than or equal to
the absolute value of the quotient of the two operands. The result is
zero or positive when the two operands have the same sign and zero or
negative when the two operands have opposite signs.

There is one special case that does not satisfy this rule: if the
dividend is the negative integer of largest possible magnitude for its
type, and the divisor is `-1`, then integer overflow occurs and the
result is equal to the dividend. Despite the overflow, no exception is
thrown in this case. On the other hand if the value of the divisor in an
integer division is `0`, then a `DivisionByZeroException` is thrown.

@param integer $a The dividend.
@param integer $b The divisor.

@return integer The quotient.

@throws InvalidArgumentException If one of the arguments is not an
integer.
@throws \DivisionByZeroError  If the divisor is zero.
Returns the quotient of the arguments . The division rounds the result towards zero . Thus the absolute value of the result is the largest possible integer that is less than or equal to the absolute value of the quotient of the two operands . The result is zero or positive when the two operands have the same sign and zero or negative when the two operands have opposite signs . There is one special case that does not satisfy this rule : if the dividend is the negative integer of largest possible magnitude for its type and the divisor is ` - 1 ` then integer overflow occurs and the result is equal to the dividend . Despite the overflow no exception is thrown in this case . On the other hand if the value of the divisor in an integer division is ` 0 ` then a ` DivisionByZeroException ` is thrown . @param integer $a The dividend . @param integer $b The divisor . @return integer The quotient . @throws InvalidArgumentException If one of the arguments is not an integer . @throws \ DivisionByZeroError If the divisor is zero .
public static function divide($a, $b)
    {
        self::assertInteger($a);
        self::assertInteger($b);
        if (0 === $b) {
            throw new \DivisionByZeroError('Division by zero.');
        }
        if ($a === \PHP_INT_MIN && $b === -1) {
            return $a;
        }
        return ($a - ($a % $b)) / $b;
    }
public static function divide ( $ a , $ b ) { self :: assertInteger ( $ a ) ; self :: assertInteger ( $ b ) ; if ( 0 === $ b ) { throw new \ DivisionByZeroError ( 'Division by zero.' ) ; } if ( $ a === \ PHP_INT_MIN && $ b === - 1 ) { return $ a ; } return ( $ a - ( $ a % $ b ) ) / $ b ; }
Returns the quotient of the arguments.
Returns the quotient of the arguments .