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

Must-Know Topics of PHP
Can you guys list the must-know topics of PHP. I am still a learner and I am trying to cover most of

Port scanner problem
Hai
recently i developed one app through which u can check the opened and closed ports under an

Validation
Hello

I know this is a really vag question.

I need to have a input field on a form th

does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how

firefox wouldnt stream mp3 files completely from my php page
hi everyone,
I have a php file trying to read and stream mp3 files. It works fine in IE but my pr

how do i make new line after *
First check this page here. and you see my report. Im pulling form a mysql db. I want to beable to m

standard ALV application toolbar, into custom report....
HI,

I have a question regarding displaying standard ALV menu path and application toolbar

Undefined index: username HELP NEWBIE
I am trying a simple login/logout for my website. It works well with checking if the username exists

BIG file upload!
Hey guys!

I'm trying to upload a file, it works well with smaller files but with 60mb+, I get

[RESOLVED] Socket/Port remains open after app crashes
I'm having this problem with a networked app in vb.net.

If the program exits normally the por

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