str_pad($str,長度,要補的字元,靠左或靠右);
$str = '123';
echo str_pad($str,10,"0",STR_PAD_LEFT);
//輸出:0000000123
echo str_pad($str,10,"0",STR_PAD_RIGHT);
//輸出:1230000000
echo str_pad($str,10,"0",STR_PAD_BOTH);
//輸出:0001230000
str_pad($str,長度,要補的字元,靠左或靠右);
$str = '123';
echo str_pad($str,10,"0",STR_PAD_LEFT);
//輸出:0000000123
echo str_pad($str,10,"0",STR_PAD_RIGHT);
//輸出:1230000000
echo str_pad($str,10,"0",STR_PAD_BOTH);
//輸出:0001230000