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

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

How to make URL loads only on login
On my page, when a user login he's redirects to user_home.php. I made it also to open the chat scree

sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that

How to Detect it is public_html or httpdocs?
How to check whether it is cPanel or Plesk?

If it found public_html perform <?php incl

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my ph

PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried vie

BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview

"From field" in PHP email form
I used a wizard to create a PHP email form. I was able to customize it with the exception of the Fr

finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");
$rc = 1;
while(!feof($openedfile))
{<

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