将一个数字转换为下一个10,20,30,依此类推


convert a number to the next 10,20,30 and so on

可能重复:
php最接近的第十个值

我想要一个类似于ceil的函数,但要得到下一个10,20,30,40,60,70,80,90100数字

示例:

$x = 5;
echo theunction($x);

返回10,如果$x = 15.5;,则应返回20,依此类推

只需尝试

$x = ceil($x/10) * 10;