Solved

Find nearest number php

Posted on 2014-11-25
2
70 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 49

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
format the code in java 6 93
only14 challenge 19 76
map interface methods 3 67
split53 challenge 7 96
Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 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