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

Generating unique numbers using php
Hi,
I need help in generating unique number using php.I tired using rand() in php.But, by using r

timezone change with date()
so i put all my times for posts in my made from scratch forum(not phpbb3 or sm)
in my mysql db u

php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro

PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator

I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

How to read posted binary data from a mobile device and post it to a web server?
Here is the senario...

I have a mobile device (MD) that posts binary data to a Web Server (WS

Is it possible to put an entire 500-page book in a database with PHP?
I am working on an intranet and I was wondering if its possible to code php with mysql to enter a fu

newbie question
Hi out thereIm totaly new in this forum and to .net and vb so here is a totaly newbie question.I wan

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