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.

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

Web Application Recipe
Hi Guys!

I am working with the Web Application recipes. I am currently working on the sen

Using CSS to format MySQL query
Hi,

If i want to have a news page on my site, which displays all records of a table in descen

ALV grid with 2 headers
Hi Gurus,

I need to display ALV GRID as below.

Header1

values in array being escaped
I would like to submit some values - back to the same form for checking before processing...

Using mysql_real_escape_string for displayed content
On my website users can input data into a textarea and it will store it in the mysql database. But,

session variables not working anymore
hello,
i use sessions to handle authentication within my site. my host has been changing a lot of

Onclick problem in Firefox
Hi,
I am using a . It doesn't seem to

SOAP Issue
Hi,

I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.

Search function
I am looking for some guidance from the experts.

I am trying to create a search function. It

Getting PHP to ammended the selected in option field
Hey Guys

thanks for everyones help so far. This site and its users are oozing awesomness.

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