Re: [PHP] Outputting a 2 digit number < 10
I normally solve this problem by doing a "< 10" test, on the assumption it is quicker. Something like for ($i=00;$i<$daysinmonth;$i++) { $str_i= (string) $i; if ( $i < 10 ) { $str_i = "0$str_i"; } if ($i == $day) { echo("$str_i\n"); } e
Re: [PHP] Outputting a 2 digit number < 10
Jamie wrote: > > ... > > "; > $day = (date ("d")); > $daysinmonth = (date("t")); > for ($i=00;$i<$daysinmonth;$i++){ > if ($i == $day) { >echo("$i\n"); > } else { > echo("$i\n"); >} > } >