Hello.
How to get float (10.00) from int (10)?
Options with the addition of $string .= ".00"; not interested.
Hello.
How to get float (10.00) from int (10)?
Options with the addition of $string .= ".00"; not interested.
You can cast a variable to a float / double type using one of the methods of explicit type casting.
<?php $number = (double)10; echo gettype($number); or so
<?php $number = 10; settype($number, 'float'); echo gettype($number); If you are interested in formatting, you can use the function sprintf()
<?php echo sprintf('%0.2f', 10); or printf()
<?php printf('%0.2f', 10); Все забыли про number_format :( (c) modal - ikerya pmSource: https://ru.stackoverflow.com/questions/541052/
All Articles