src/Money.php
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP)
    {
        $this->assertOperand($divisor);
        $this->assertRoundingMode($roundingMode);

        $divisor = (string) Number::fromNumber($divisor);

        if ($this->getCalculator()->compare($divisor, '0') === 0) {
            throw new \InvalidArgumentException('Division by zero');
        }

        $quotient = $this->round($this->getCalculator()->divide($this->amount, $divisor), $roundingMode);

        return $this->newInstance($quotient);
    }
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP)
    {
        $this->assertOperand($divisor);
        $this->assertRoundingMode($roundingMode);

        $divisor = (string) Number::fromNumber($divisor);

        if ($this->getCalculator()->compare($divisor, '0') === 0) {
            throw new \InvalidArgumentException('Division by zero');
        }

        $quotient = $this->round($this->getCalculator()->divide($this->amount, $divisor), $roundingMode);

        return $this->newInstance($quotient);
    }
public function divide ( $ divisor , $ roundingMode = self :: ROUND_HALF_UP ) { $ this -> assertOperand ( $ divisor ) ; $ this -> assertRoundingMode ( $ roundingMode ) ; $ divisor = ( string ) Number :: fromNumber ( $ divisor ) ; if ( $ this -> getCalculator ( ) -> compare ( $ divisor , '0' ) === 0 ) { throw new \ InvalidArgumentException ( 'Division by zero' ) ; } $ quotient = $ this -> round ( $ this -> getCalculator ( ) -> divide ( $ this -> amount , $ divisor ) , $ roundingMode ) ; return $ this -> newInstance ( $ quotient ) ; }
Returns a new Money object that represents
the divided value by the given factor.

@param float|int|string $divisor
@param int              $roundingMode

@return Money
Returns a new Money object that represents the divided value by the given factor .