-2

This is my life problem how do I keep the last zero?

<?php
$x = 1456.20;
echo $x;//1456.2 but i need 1456.20
?>

Thank you

21bn
  • 117
  • 1
  • 2
  • 12

1 Answers1

0

You can use number_format

<?php
echo number_format($x, 2);
?>
prehfeldt
  • 2,184
  • 2
  • 28
  • 48