Rounds up an arbitrary precision number

# BcMath\Number::ceil

(PHP 8 >= 8.4.0)

BcMath\Number::ceil — Rounds up an arbitrary precision number

### Beschreibung

public function BcMath\Number::ceil(): BcMath\Number

Returns the next highest integer value by rounding up $this if necessary.

### Parameter-Liste

Diese Funktion besitzt keine Parameter.

### Rückgabewerte

Returns the result as a new BcMath\Number object. The BcMath\Number::scale of the result is always `0`.

### Beispiele

Beispiel #1 BcMath\Number::ceil() example

    <?php
    $num1 = new BcMath\Number('4.3')->ceil();
    $num2 = new BcMath\Number('9.999')->ceil();
    $num3 = new BcMath\Number('-3.14')->ceil();

    var_dump($num1, $num2, $num3);
    ?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    object(BcMath\Number)#2 (2) {
      ["value"]=>
      string(1) "5"
      ["scale"]=>
      int(0)
    }
    object(BcMath\Number)#3 (2) {
      ["value"]=>
      string(2) "10"
      ["scale"]=>
      int(0)
    }
    object(BcMath\Number)#4 (2) {
      ["value"]=>
      string(2) "-3"
      ["scale"]=>
      int(0)
    }

### Siehe auch

- bcceil() - Round up arbitrary precision number
- BcMath\Number::floor() - Rounds down an arbitrary precision number
- BcMath\Number::round() - Rounds an arbitrary precision number

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open