Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

number format in php with decimal values

<?php
$number1 = 5;
$number2 = 34.600;
$number3 = 15439.093;
$format_number1 = number_format($number1, 2);
$format_number2 = number_format($number2, 2);
$format_number3 = number_format($number3, 2, "d", "@");
echo "The number $number1 after formating is: $format_number1 
";
echo "The number $number2 after formating is: $format_number2 
";
echo "The number $number3 after formating is: $format_number3 
";

//Output

The number 5 after formating is: 5.00 
The number 34.6 after formating is: 34.60 
The number 15439.093 after formating is: 15@439d09


?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #number #format #php #decimal #values
ADD COMMENT
Topic
Name
5+2 =