3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $currentDate = new DateTime(); $currentDay = $currentDate->format("j"); // Number of days in the current month $daysInMonth = $currentDate->format("t"); $daysToProlong = range($currentDay, 31); $daysToProlongSql = implode(', ', $daysToProlong); var_dump($currentDay); var_dump($daysInMonth); var_dump($daysToProlong); var_dump($daysToProlongSql);
based on X1VA9
Output for 5.3.19 - 5.4.45, 5.6.15, 5.6.28, 7.0.20 - 7.2.0
string(2) "29" string(2) "31" array(3) { [0]=> int(29) [1]=> int(30) [2]=> int(31) } string(10) "29, 30, 31"
Output for 7.0.6
string(1) "3" string(2) "31" array(29) { [0]=> int(3) [1]=> int(4) [2]=> int(5) [3]=> int(6) [4]=> int(7) [5]=> int(8) [6]=> int(9) [7]=> int(10) [8]=> int(11) [9]=> int(12) [10]=> int(13) [11]=> int(14) [12]=> int(15) [13]=> int(16) [14]=> int(17) [15]=> int(18) [16]=> int(19) [17]=> int(20) [18]=> int(21) [19]=> int(22) [20]=> int(23) [21]=> int(24) [22]=> int(25) [23]=> int(26) [24]=> int(27) [25]=> int(28) [26]=> int(29) [27]=> int(30) [28]=> int(31) } string(107) "3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 7.0.5
string(1) "3" string(2) "30" array(29) { [0]=> int(3) [1]=> int(4) [2]=> int(5) [3]=> int(6) [4]=> int(7) [5]=> int(8) [6]=> int(9) [7]=> int(10) [8]=> int(11) [9]=> int(12) [10]=> int(13) [11]=> int(14) [12]=> int(15) [13]=> int(16) [14]=> int(17) [15]=> int(18) [16]=> int(19) [17]=> int(20) [18]=> int(21) [19]=> int(22) [20]=> int(23) [21]=> int(24) [22]=> int(25) [23]=> int(26) [24]=> int(27) [25]=> int(28) [26]=> int(29) [27]=> int(30) [28]=> int(31) } string(107) "3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 7.0.4
string(2) "10" string(2) "31" array(22) { [0]=> int(10) [1]=> int(11) [2]=> int(12) [3]=> int(13) [4]=> int(14) [5]=> int(15) [6]=> int(16) [7]=> int(17) [8]=> int(18) [9]=> int(19) [10]=> int(20) [11]=> int(21) [12]=> int(22) [13]=> int(23) [14]=> int(24) [15]=> int(25) [16]=> int(26) [17]=> int(27) [18]=> int(28) [19]=> int(29) [20]=> int(30) [21]=> int(31) } string(86) "10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 7.0.3
string(2) "18" string(2) "31" array(14) { [0]=> int(18) [1]=> int(19) [2]=> int(20) [3]=> int(21) [4]=> int(22) [5]=> int(23) [6]=> int(24) [7]=> int(25) [8]=> int(26) [9]=> int(27) [10]=> int(28) [11]=> int(29) [12]=> int(30) [13]=> int(31) } string(54) "18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 7.0.2
string(2) "23" string(2) "31" array(9) { [0]=> int(23) [1]=> int(24) [2]=> int(25) [3]=> int(26) [4]=> int(27) [5]=> int(28) [6]=> int(29) [7]=> int(30) [8]=> int(31) } string(34) "23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.24, 7.0.1
string(2) "24" string(2) "31" array(8) { [0]=> int(24) [1]=> int(25) [2]=> int(26) [3]=> int(27) [4]=> int(28) [5]=> int(29) [6]=> int(30) [7]=> int(31) } string(30) "24, 25, 26, 27, 28, 29, 30, 31"
Output for 7.0.0
string(2) "27" string(2) "31" array(5) { [0]=> int(27) [1]=> int(28) [2]=> int(29) [3]=> int(30) [4]=> int(31) } string(18) "27, 28, 29, 30, 31"
Output for 5.6.21
string(1) "2" string(2) "31" array(30) { [0]=> int(2) [1]=> int(3) [2]=> int(4) [3]=> int(5) [4]=> int(6) [5]=> int(7) [6]=> int(8) [7]=> int(9) [8]=> int(10) [9]=> int(11) [10]=> int(12) [11]=> int(13) [12]=> int(14) [13]=> int(15) [14]=> int(16) [15]=> int(17) [16]=> int(18) [17]=> int(19) [18]=> int(20) [19]=> int(21) [20]=> int(22) [21]=> int(23) [22]=> int(24) [23]=> int(25) [24]=> int(26) [25]=> int(27) [26]=> int(28) [27]=> int(29) [28]=> int(30) [29]=> int(31) } string(110) "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.20
string(2) "10" string(2) "30" array(22) { [0]=> int(10) [1]=> int(11) [2]=> int(12) [3]=> int(13) [4]=> int(14) [5]=> int(15) [6]=> int(16) [7]=> int(17) [8]=> int(18) [9]=> int(19) [10]=> int(20) [11]=> int(21) [12]=> int(22) [13]=> int(23) [14]=> int(24) [15]=> int(25) [16]=> int(26) [17]=> int(27) [18]=> int(28) [19]=> int(29) [20]=> int(30) [21]=> int(31) } string(86) "10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.19
string(1) "8" string(2) "31" array(24) { [0]=> int(8) [1]=> int(9) [2]=> int(10) [3]=> int(11) [4]=> int(12) [5]=> int(13) [6]=> int(14) [7]=> int(15) [8]=> int(16) [9]=> int(17) [10]=> int(18) [11]=> int(19) [12]=> int(20) [13]=> int(21) [14]=> int(22) [15]=> int(23) [16]=> int(24) [17]=> int(25) [18]=> int(26) [19]=> int(27) [20]=> int(28) [21]=> int(29) [22]=> int(30) [23]=> int(31) } string(92) "8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.18
string(2) "15" string(2) "31" array(17) { [0]=> int(15) [1]=> int(16) [2]=> int(17) [3]=> int(18) [4]=> int(19) [5]=> int(20) [6]=> int(21) [7]=> int(22) [8]=> int(23) [9]=> int(24) [10]=> int(25) [11]=> int(26) [12]=> int(27) [13]=> int(28) [14]=> int(29) [15]=> int(30) [16]=> int(31) } string(66) "15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.17
string(2) "19" string(2) "31" array(13) { [0]=> int(19) [1]=> int(20) [2]=> int(21) [3]=> int(22) [4]=> int(23) [5]=> int(24) [6]=> int(25) [7]=> int(26) [8]=> int(27) [9]=> int(28) [10]=> int(29) [11]=> int(30) [12]=> int(31) } string(50) "19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.16
string(2) "28" string(2) "31" array(4) { [0]=> int(28) [1]=> int(29) [2]=> int(30) [3]=> int(31) } string(14) "28, 29, 30, 31"
Output for 5.6.14
string(1) "2" string(2) "30" array(30) { [0]=> int(2) [1]=> int(3) [2]=> int(4) [3]=> int(5) [4]=> int(6) [5]=> int(7) [6]=> int(8) [7]=> int(9) [8]=> int(10) [9]=> int(11) [10]=> int(12) [11]=> int(13) [12]=> int(14) [13]=> int(15) [14]=> int(16) [15]=> int(17) [16]=> int(18) [17]=> int(19) [18]=> int(20) [19]=> int(21) [20]=> int(22) [21]=> int(23) [22]=> int(24) [23]=> int(25) [24]=> int(26) [25]=> int(27) [26]=> int(28) [27]=> int(29) [28]=> int(30) [29]=> int(31) } string(110) "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.13
string(2) "15" string(2) "30" array(17) { [0]=> int(15) [1]=> int(16) [2]=> int(17) [3]=> int(18) [4]=> int(19) [5]=> int(20) [6]=> int(21) [7]=> int(22) [8]=> int(23) [9]=> int(24) [10]=> int(25) [11]=> int(26) [12]=> int(27) [13]=> int(28) [14]=> int(29) [15]=> int(30) [16]=> int(31) } string(66) "15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.12
string(2) "20" string(2) "30" array(12) { [0]=> int(20) [1]=> int(21) [2]=> int(22) [3]=> int(23) [4]=> int(24) [5]=> int(25) [6]=> int(26) [7]=> int(27) [8]=> int(28) [9]=> int(29) [10]=> int(30) [11]=> int(31) } string(46) "20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.11
string(2) "24" string(2) "30" array(8) { [0]=> int(24) [1]=> int(25) [2]=> int(26) [3]=> int(27) [4]=> int(28) [5]=> int(29) [6]=> int(30) [7]=> int(31) } string(30) "24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.6.10
string(2) "25" string(2) "30" array(7) { [0]=> int(25) [1]=> int(26) [2]=> int(27) [3]=> int(28) [4]=> int(29) [5]=> int(30) [6]=> int(31) } string(26) "25, 26, 27, 28, 29, 30, 31"
Output for 5.6.9
string(2) "27" string(2) "30" array(5) { [0]=> int(27) [1]=> int(28) [2]=> int(29) [3]=> int(30) [4]=> int(31) } string(18) "27, 28, 29, 30, 31"
Output for 5.6.8
string(2) "30" string(2) "30" array(2) { [0]=> int(30) [1]=> int(31) } string(6) "30, 31"
Output for 5.5.35
string(2) "22" string(2) "31" array(10) { [0]=> int(22) [1]=> int(23) [2]=> int(24) [3]=> int(25) [4]=> int(26) [5]=> int(27) [6]=> int(28) [7]=> int(29) [8]=> int(30) [9]=> int(31) } string(38) "22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.34
string(2) "11" string(2) "30" array(21) { [0]=> int(11) [1]=> int(12) [2]=> int(13) [3]=> int(14) [4]=> int(15) [5]=> int(16) [6]=> int(17) [7]=> int(18) [8]=> int(19) [9]=> int(20) [10]=> int(21) [11]=> int(22) [12]=> int(23) [13]=> int(24) [14]=> int(25) [15]=> int(26) [16]=> int(27) [17]=> int(28) [18]=> int(29) [19]=> int(30) [20]=> int(31) } string(82) "11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.33
string(1) "9" string(2) "31" array(23) { [0]=> int(9) [1]=> int(10) [2]=> int(11) [3]=> int(12) [4]=> int(13) [5]=> int(14) [6]=> int(15) [7]=> int(16) [8]=> int(17) [9]=> int(18) [10]=> int(19) [11]=> int(20) [12]=> int(21) [13]=> int(22) [14]=> int(23) [15]=> int(24) [16]=> int(25) [17]=> int(26) [18]=> int(27) [19]=> int(28) [20]=> int(29) [21]=> int(30) [22]=> int(31) } string(89) "9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.32
string(2) "17" string(2) "31" array(15) { [0]=> int(17) [1]=> int(18) [2]=> int(19) [3]=> int(20) [4]=> int(21) [5]=> int(22) [6]=> int(23) [7]=> int(24) [8]=> int(25) [9]=> int(26) [10]=> int(27) [11]=> int(28) [12]=> int(29) [13]=> int(30) [14]=> int(31) } string(58) "17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.31
string(2) "21" string(2) "31" array(11) { [0]=> int(21) [1]=> int(22) [2]=> int(23) [3]=> int(24) [4]=> int(25) [5]=> int(26) [6]=> int(27) [7]=> int(28) [8]=> int(29) [9]=> int(30) [10]=> int(31) } string(42) "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.30
string(1) "1" string(2) "30" array(31) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) [6]=> int(7) [7]=> int(8) [8]=> int(9) [9]=> int(10) [10]=> int(11) [11]=> int(12) [12]=> int(13) [13]=> int(14) [14]=> int(15) [15]=> int(16) [16]=> int(17) [17]=> int(18) [18]=> int(19) [19]=> int(20) [20]=> int(21) [21]=> int(22) [22]=> int(23) [23]=> int(24) [24]=> int(25) [25]=> int(26) [26]=> int(27) [27]=> int(28) [28]=> int(29) [29]=> int(30) [30]=> int(31) } string(113) "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.29
string(2) "17" string(2) "30" array(15) { [0]=> int(17) [1]=> int(18) [2]=> int(19) [3]=> int(20) [4]=> int(21) [5]=> int(22) [6]=> int(23) [7]=> int(24) [8]=> int(25) [9]=> int(26) [10]=> int(27) [11]=> int(28) [12]=> int(29) [13]=> int(30) [14]=> int(31) } string(58) "17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.28
string(2) "21" string(2) "30" array(11) { [0]=> int(21) [1]=> int(22) [2]=> int(23) [3]=> int(24) [4]=> int(25) [5]=> int(26) [6]=> int(27) [7]=> int(28) [8]=> int(29) [9]=> int(30) [10]=> int(31) } string(42) "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.27
string(2) "22" string(2) "30" array(10) { [0]=> int(22) [1]=> int(23) [2]=> int(24) [3]=> int(25) [4]=> int(26) [5]=> int(27) [6]=> int(28) [7]=> int(29) [8]=> int(30) [9]=> int(31) } string(38) "22, 23, 24, 25, 26, 27, 28, 29, 30, 31"
Output for 5.5.26
string(2) "26" string(2) "30" array(6) { [0]=> int(26) [1]=> int(27) [2]=> int(28) [3]=> int(29) [4]=> int(30) [5]=> int(31) } string(22) "26, 27, 28, 29, 30, 31"
Output for 5.5.25
string(2) "28" string(2) "30" array(4) { [0]=> int(28) [1]=> int(29) [2]=> int(30) [3]=> int(31) } string(14) "28, 29, 30, 31"