PHP Learning Bench
This site is helpful to all basic learners in php.
Thursday, November 01, 2012
PHP Display floating number with 2 leading zeros
<?php
$no = "2.8" ;
$no1 = sprintf("%01.2f",$no);
echo $no1;
echo "<br/>";
?>
output : 2.80
// suppose input is 0.4 => output 0.40
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment