$cont = 1;
<?php echo $cont++ ?>:
Generate a list like:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ...
But how to leave it like this:
01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 ...
But only when you have more than 10 numbers, or more than 100
$cont = 1;
<?php echo $cont++ ?>:
Generate a list like:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ...
But how to leave it like this:
01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 ...
But only when you have more than 10 numbers, or more than 100
Using php's str_pad
<?php echo str_pad($count_number++, 2, 0, STR_PAD_LEFT); ?>