hi guys,

im trying to loop a variable using 00 format..

ex. 01,02,03,04.......31

im going to use this for my dropdown of date. thanks!

Use this code:

$a = array_map(create_function('$x', 'return sprintf("%02s", $x);'), range(1,31));

Perhaps for() and if () is much faster (optimize hosting resources) than array_map(), create_function(), range() and sprintf() from aquilax example.

for ($i = 1; $i <= 31; $i++) echo '<option value="'.($d = $i < 10 ? '0'.$i : ''.$i).'">'.$d.'</option>';