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);