3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $total = 38.500000; $newTotal = number_format($total,2); echo "NumberFormat: " . $newTotal . "\n"; echo "Float: " . sprintf("%.2f", $total) . "\n"; echo "Double: " .sprintf("%g", $total) . "\n";
Output for 5.2.1 - 7.1.0
NumberFormat: 38.50 Float: 38.50 Double: 38.5
Output for 4.3.0 - 5.2.0
NumberFormat: 38.50 Float: 38.50 Double: