Home >Backend Development >PHP Tutorial > PHP怎样在不足两位数前加 0 补足两位数呢解决方法

PHP怎样在不足两位数前加 0 补足两位数呢解决方法

WBOY
WBOYOriginal
2016-06-13 13:40:181205browse

PHP怎样在不足两位数前加 0 补足两位数呢
PHP怎样在不足两位数前加 0 补足两位数呢

------解决方案--------------------

PHP code

$number=9;
$number=sprintf ( "%02d",$number);
echo $number; <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn