3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(range(1, 31));die; $date = "4/23/15"; preg_match('~^1|2|3|4\/' . implode('|', range(1, 31)) . '\/[0-9]{2}$~', $date, $m); var_dump($m);
based on iYUWm
Output for 4.3.0 - 7.2.0
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) }