Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有:
echo number_format( $uti->check_price( $rowscatpr ) , 0, '', '.' );
格式:333.333.333
我要格式:0333.333.333
有没有一个PHP函数呢?
$input = number_format( $uti->check_price( $rowscatpr ) , 0, '', '.' ); echo str_pad($input, strlen($input)+1, "0", STR_PAD_LEFT); //0333.333.333
str_pad — 用另一个字符串将一个字符串填充到一定长度。
strlen — 返回给定字符串的长度。
$v=number_format( $uti->check_price( $rowscatpr ) , 0, '', '.' ); echo str_pad($v,strlen($v)+1,'0',STR_PAD_LEFT);