047-PHP number with leading zeros, fixed number of 0s

<? PHP
 # the PHP fixed number of leading zeros digital complement 0 
    $ NUM = 128 ;
     $ NUM = str_pad ( $ NUM ,. 8, "0", STR_PAD_LEFT);
     echo  $ NUM ;
     // Output: 0128 
?>

 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/10994318.html