Skip to content

Daily Archives: October 31, 2019

You are here:
  1. Home
  2. 2019
  3. October
  4. 31

Convert any number to two digits number (with two decimal places), with PHP

PHPBy kavecanOctober 31, 2019

Always important. Let’s say that you need to convert single number, to number with two decimal places. Primary number you want to convert can be with or without decimal places, integer, decimal, or even string type. $number = 1205;echo number_format((float)$number, 2, ‘.’, ”); This will return a string. Output will be: 1205.00

© 2026. Kavecan.com. All rights reserved.
Go to Top