What is the approximate number indicated by php?

function numDisplay($num){

    if ($num >= 11 && $num <= 20){
        $str = "10+";
    }else if ($num >= 21 && $num <= 30){
        $str = "20+";
    }
    return $str;
}

this kind of manual addition seems to be too much.
is there a better way to do this? Automatically follow such rules

Apr.09,2021


function numDisplay($num = 0){
    return ($num<10)?$num:strval($num)[0].'0+';
}

-add if the length is unknown-

 function numDisplay($num = 0){
      return ($num<10)?$num:strval($num)[0].str_repeat('0',strlen($num)-1).'+';
  }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b379d8-4ed11.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b379d8-4ed11.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?