Converting Integer String to Money Format

前端 未结 4 2057
情歌与酒
情歌与酒 2020-12-19 17:51

I have a set of integers that I would like to change to a US money format.

Here are some examples of what I would like to do. The first number is what is in the dat

相关标签:
4条回答
  • 2020-12-19 18:30

    Have you looked at money_format()? You'll just need to divide your values by 100 before using them w/this function.

    Also, you could consider number_format() as well.

    0 讨论(0)
  • 2020-12-19 18:40

    You could use number_format()

    number_format((4500/100), 2);
    

    There's also money_format(), but it's slightly more complicated.

    0 讨论(0)
  • 2020-12-19 18:40

    Take a look at money_format, which formats a number as a currency string.

    0 讨论(0)
  • 2020-12-19 18:44
    $number=4500;
    $money='$'.round($number/100,2);
    
    0 讨论(0)
提交回复
热议问题