Solved

Find nearest number php

Posted on 2014-11-25
2
75 Views
Last Modified: 2015-08-14
How to find the nearest tenth number in php.
Example: if input is 58, output should be 60
if input is 92, the output should be 90

Thanks.
0
Comment
Question by:rameshitm
2 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 40464210
Hi,

pls try

$number = round($input / 10) * 10;

Regards
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40464220
echo round(58, -1);
echo round(92, -1);
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
map interface methods 3 72
fizzArray3  challenge 1 93
Python multiple IF statements 4 88
Android development question 2 52
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question