Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PHP
- $number = 105
- return number_format((float)$number, 2, '.', '');
- Example:
- $foo = "105";
- echo number_format((float)$foo, 2, '.', ''); // Outputs -> 105.00
- JAVASCRIPT
- DecimalFormat df = new DecimalFormat("#.00");
- double angle = 20.3034;
- DecimalFormat df = new DecimalFormat("#.00");
- String angleFormated = df.format(angle);
- System.out.println(angleFormated); //output 20.30
- TWIG
- {{ 200.35|number_format }}
- {{ 9800.333|number_format(2, '.', ',') }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement