문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top