Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Commit

Permalink
remove ultimo zero apenas se o valor for diferente de zero
Browse files Browse the repository at this point in the history
  • Loading branch information
DaviMenezes committed Mar 21, 2019
1 parent 225ffe5 commit de029aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/helpers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ function money($dollar = 0)
{
$dollar = empty($dollar) ? 0 : $dollar;
$dollar = str_replace([',', '.'], '', $dollar);
$dollar = str($dollar)->removeLeft('00')->removeLeft('0')->str();
$dollar = str($dollar)->removeLeft('00');
if ($dollar->str() !== '0') {
$dollar = $dollar->removeLeft('0')->str();
}
$money = Money::USD($dollar);
return $money;
}

0 comments on commit de029aa

Please sign in to comment.