8 || (int) $whole > 21474836 || ( (int) $whole === 21474836 && $fraction > 47 ) ) { throw new \InvalidArgumentException( 'money_input' ); } $cents = (int) $whole * 100 + $fraction; Currency::validate( $cents, $currency ); return $cents; } /** Stable machine value for inputs and exports, independent of currency/locale. */ public static function format( int $cents ): string { if ( $cents < 0 || $cents > 2147483647 ) { throw new \InvalidArgumentException( 'money_input' ); } return (string) intdiv( $cents, 100 ) . '.' . str_pad( (string) ( $cents % 100 ), 2, '0', STR_PAD_LEFT ); } }