## make number format upto 2 decimal point here we can use, number_format(): echo number_format((float)$number, 2, '.', ''); ## Example: $foo = "105"; echo number_format((float)$foo, 2, '.', ''); // Outputs => 105.00 This function returns a string.
## also we can do using this:
$padded = sprintf('%0.2f', $unpadded);
// 520 -> 520.00