21 public static function format($number, $precision = 2): string
23 return Format::DOLLAR($number, $precision);
41 public static function decimal($fractionalDollar = null, $fraction = 0)
47 if ($fractionalDollar === null || $fraction < 0) {
54 $dollars = floor($fractionalDollar);
55 $cents = fmod($fractionalDollar, 1);
57 $cents *= 10 ** ceil(log10($fraction));
59 return $dollars + $cents;
77 public static function fractional($decimalDollar = null, $fraction = 0)
83 if ($decimalDollar === null || $fraction < 0) {
90 $dollars = floor($decimalDollar);
91 $cents = fmod($decimalDollar, 1);
93 $cents *= 10 ** (-ceil(log10($fraction)));
95 return $dollars + $cents;
static fractional($decimalDollar=null, $fraction=0)
DOLLARFR.
static format($number, $precision=2)
DOLLAR.
static decimal($fractionalDollar=null, $fraction=0)
DOLLARDE.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.