Indexing 两位数索引

Indexing 两位数索引,indexing,double,digits,Indexing,Double,Digits,我以HTML格式编写了以下代码: <select name="createdDay"><?php for ($i=1; $i <= 31 ; $i++) {echo '<option>' . $i . '</option>';} ?> 索引只上升了个位数到10,请问有没有办法用两位数?示例01、02、03、04 我已尝试预修复0或I=01,但无效 使用,它允许您指定格式化/填充字符,如 $formatted = sprintf('%0

我以HTML格式编写了以下代码:

<select name="createdDay"><?php for ($i=1; $i <= 31 ; $i++) 
{echo '<option>' . $i . '</option>';} ?>

索引只上升了个位数到10,请问有没有办法用两位数?示例01、02、03、04

我已尝试预修复0或I=01,但无效

使用,它允许您指定格式化/填充字符,如

$formatted = sprintf('%02d', $i); // 1 -> 01, 10 -> 10