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

BAPI BBP_INB_DELIVERY_CREATE - material number missing in delivery
Hi Experts,

I was able to successfully create an Inbound delivery with reference to a PO

Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a resu

Post, not working, please help
The error is:
Method Not Allowed
The requested method POST is not allowed for the URL /student

Confusing Functions
So, I've been reading up on Functions and I like them! However, I need some help using variables in

Big Problem!! Please help
Hi Guys,

Im making a website for a friend have encountered a really annoying problem. When ev

Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so

INSERT for date range
Hi all

I have the following table

Code: [Select] `date` date
`day` int(2)
`

Simple email form - Newbie
Hello all,

First time poster!

I've been asked to create a simple HTML form that submit

Edit MySQL Row Using PHP and HTML Form
Hello,

Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.

What are the two different files you download to update kernel?
What are the two different files you download to update kernel?

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