Can you please take a look at this demo and let me know how I can I insert two digits format (even for the numbers less than 10) like 01, 02, 03,..., 09
into the array $days
$days = [];
for ($i = 1; $i <= 30; $i++) {
array_push($days, $i);
}
echo '<pre>';
print_r ($days);
echo '</pre>';
the out put looks like
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
[7] => 8
[8] => 9
[9] => 10
[10] => 11
[11] => 12
[12] => 13
[13] => 14
[14] => 15
[15] => 16
[16] => 17
[17] => 18
[18] => 19
[19] => 20
[20] => 21
[21] => 22
[22] => 23
[23] => 24
[24] => 25
[25] => 26
[26] => 27
[27] => 28
[28] => 29
[29] => 30
)
but I need to ave like:
Array
(
[0] => 01
[1] => 02
[2] => 03
[3] => 04
[4] => 05
[5] => 06
[6] => 07
[7] => 08
[8] => 09
[9] => 10
[10] => 11
[11] => 12
[12] => 13
[13] => 14
[14] => 15
[15] => 16
[16] => 17
[17] => 18
[18] => 19
[19] => 20
[20] => 21
[21] => 22
[22] => 23
[23] => 24
[24] => 25
[25] => 26
[26] => 27
[27] => 28
[28] => 29
[29] => 30
)