mini\Util\Math\Decimal::of() Method

public static

Signature

public static function of(string|int $value, int $scale = 0): self

Parameters

Name Type Default Description
$value string|int required Documentation missing
$scale int 0 Documentation missing

Returns

self

Documentation

Create from string/int with specified scale

The input value is adjusted to match the target scale:

  • Decimal::of('123.45', 2) → unscaled=12345, scale=2
  • Decimal::of('123.45', 4) → unscaled=1234500, scale=4
  • Decimal::of('123', 2) → unscaled=12300, scale=2
  • Decimal::of(100, 2) → unscaled=10000, scale=2

Source

src/Util/Math/Decimal.php:46-97