I'm developing a map and I have to save this parameters on Parse database:
lat.: 20.6350 . Long: -103.5334
The problem is when i convert them into numbers, that function converts 20.6350 to 20.635. ¿What can I do in order tu preserve the last zero?
if you want the numbers with four decimals in your database you could use the Decimal type. Under length you could enter 6,4 representing maximum of 6 digits in total and 4 digits behind the point.
If you want to display the number in PHP you could use the number_format() function
You should specify the sig figs and they will display properly.
See http://php.net/number_format for additional formatting info
UPDATE
Based on your comments above, seems the string you're pulling varies in length, correct?
Why not just get the amount of sig figs after the decimal then use that as the second argument in
number_format()
? I'm sure there is a more appropriate way to handle, but this would work I believe.or in one line