Divide it with 100000000, or use "pow" function:
$number / pow(10, 8);
题
I have been trying all morning but how would I this number 1304583496
to look like this
13.04583496
and the same goes for this number
456604223
to 4.56604223
There are always 8 numbers to the right.
解决方案
Divide it with 100000000, or use "pow" function:
$number / pow(10, 8);
其他提示
You could also use the official number_format
method after division to keep your ending zeroes and have your number displayed in a nice manner.
<?php
$num = 1304583496; //the number
echo number_format($num/100000000,8,"."," "); //number of decimals = 8, comma seperator is . and thousands seperator is a space here
?>
For more information on this function: http://www.w3schools.com/php/func_string_number_format.asp