/** * @test */ public function formatMoney() { $this->assertEquals('10,10', Str::formatMoney(10.1)); $this->assertEquals('100,10', Str::formatMoney(100.1)); $this->assertEquals('1.000,10', Str::formatMoney(1000.1)); $this->assertEquals('1.000,10', Str::formatMoney('R$ 1000.10')); $this->assertEquals(null, Str::formatMoney(null)); }
/** * Format amount of money. * * @param mixed $amount * @param int $decimals * @param string $decPoint * @param string $thousandsSep * * @return string|null */ function str_format_money($amount, $decimals = 2, $decPoint = ',', $thousandsSep = '.') { return Str::formatMoney($amount, $decimals, $decPoint, $thousandsSep); }