Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 101
  • Last Modified:

Find nearest number php

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
rameshitm
Asked:
rameshitm
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

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

Regards
0
 
ozoCommented:
echo round(58, -1);
echo round(92, -1);
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now