Rounding a number queried from a database


Posted on 16th Feb 2014 07:03 pm by admin

I know that to display a rounded number you just do echo "round($number)";. But how would I convert the $number varible into a rounded number, so that when I say echo "$number"; the rounded number shows up? For example I have a calculation that calculates the distance between two locations using longitude and latitude. $distance is the final result. But $distance is a very long decimal number. To do further calculations with it, I would like to round $distance so that it has no decimal places anymore (So 1482.894736593 would = 1483). So $distance would now equal 1483, not 1482.894736593. Then I could go on and calculate the time, cost, etc. and $number will stay rounded.

Did you know?Explore Trending and Topic pages for more stories like this.
Do you know what I am saying?
No comments posted yet

Your Answer:

Login to answer
252 Like 8 Dislike
Previous forums Next forums
Other forums

Session is not saving
I am not trying to do anything too fancy, I am just trying to get some $_SESSION data to save and us

PHP FTP Can't upload Big FIles
Anyone had any success using FTP to upload a file say 90m?

im using ftp_put and it returns fa

Select question
Hi,

First I would like to say that php is pretty new for me..
so please don't shoot me if

quick basic question, hopefully not dumb
I don't know how to search for this, so forgive me if it's been covered...

I often see an exa

How can I uploading Transactional Data from Legacy to New SAP system
Hell Gurus,

I am overwhelmed with questions on how to migrate huge volume of Sales Orders

Give me all your tricks for minimizing jar file size

Hi, I'm coming close to releasing my J2ME game... I am kicking up against the 64k size barrier w

how to export excel file in same server
My first post - php newbie, so appreciate your support.

I'm currently using headers to save w

trim function issues
Hi guys, total noob here...

So I've been tinkering around with a html and am using php to em

Calling variables
I want to call this to my website but it doesn't display what I want it to,

Code: <h5&

Disabling SAP menu
How do I disable SAP menu for all the users and just restrict them to User Menu in SAP ECC 6.0?

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash