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.
rameshitmAsked:
Who is Participating?
 
ozoCommented:
echo round(58, -1);
echo round(92, -1);
0
 
Rgonzo1971Commented:
Hi,

pls try

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

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.