Solved

Find nearest number php

Posted on 2014-11-25
2
58 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 48

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now