php 自动补全字符串 可刷新运行 刷新

代码:

echo sprintf('%02s', '1');
echo "\n";
echo sprintf('%-02s', '1');
echo "\n";

echo str_pad('1',2,'0',STR_PAD_LEFT);
echo "\n";

echo str_pad('1',2,'0',STR_PAD_RIGHT);
echo "\n";

输出:

01
10
01
10