Final implementation, inspired from Shaunkak’s answer and SO’s comment. Thanks for these bra..s. live demo
<?php
$val = 10241.67;
if($val >= 1000) {
echo ceil($val / 1000) * 1000;
}
else {
$length = strlen(ceil($val));
$times = str_pad('1', $length, "0");
echo ceil($val / $times) * $times;
}