I am having trouble understanding the php function to add zeros after a decimal number. Let's say I have $ money = "10000" I need a function that will add from 100 to 10000.00 and add only zero to 0 after 234.5. can someone help me?
Number_format function
http://php.net/manual/en/function.number-format.php
Always find the PHP manual first :)
Just as Dan Grossman said; number_format is your friend here and you will achieve these double zeros:
$money = "1234"; $formatedNumber = number_format($money, 2, '.', ''); echo $formatedNumber; // 1234.00
, , , ,
Source: https://habr.com/ru/post/1774237/More articles:Coredump при разборе разделов - cPrinting a DIV container without losing CSS styles - jqueryAndroid - turn off the hardware keys - androidUNIX_TIMESTAMP () and time () are the same - unixDLL loading sequence at service start - windows.NET Software Update Manager - c #problem with CGI :: unescapeHTML - ruby | fooobar.comHow can I get a Click event in a ListBoxItem? - wpfhow to place vertical scrollbar in html? - htmlHow to filter emails using content and subject? - c #All Articles