[ PHP ] – 字串前方補零 2015 / 10 / 7 By jeff 0 Comments string (字串處理) 字串前方補零 $str='1'; echo str_pad($str,3,'0',STR_PAD_LEFT); //顯示結果 0001