Q:

PHP leading zero beginning with 01 not 00

I am using the following PHP in a wordpress theme for comment count...
   <?php $i = 0; foreach ($comments as $comment) : ?>       

   <?php $ii = sprintf("%02d", $i);?>

   <?php $i++;echo $ii; echo '.&ensp;';?> 

(Echo the comment number beginning with 01.)
The problem is that the first comment starts with 00. instead of 01. 
Example:
00. John Smith says...

01. Patrick Smith says...

02. Etc..

Does anyone have any suggestions?

A:

You obviously started at 0:
<?php $i = 0; foreach ...

If you wanted it to start at 1, you should code it to do so:
<?php $i = 1; foreach ...

One key to writing good code is understanding exactly what it is you're asking the computer to do.

