3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function dateRange($first, $last, $step = '+1 day', $format = 'd/m/Y' ) { echo $first; echo "<br>"; echo $last; echo "<br>"; echo $step; echo "<br>"; $dates = array(); $current = strtotime($first); $last = strtotime($last); while( $current <= $last ) { $dates[] = date($format, $current); $current = strtotime($step, $current); } print_r($dates); exit; return $dates; } dateRange('20/05/2014', '31/05/2014');
Output for 5.1.3 - 7.1.0
20/05/2014<br>31/05/2014<br>+1 day<br>Array ( [0] => 01/01/1970 )
Output for 5.1.0 - 5.1.2
20/05/2014<br>31/05/2014<br>+1 day<br>
Process exited with code 137.
Output for 4.3.0 - 5.0.5
20/05/2014<br>31/05/2014<br>+1 day<br>Array ( [0] => 05/08/2015 [1] => 06/08/2015 [2] => 07/08/2015 [3] => 08/08/2015 [4] => 09/08/2015 [5] => 10/08/2015 [6] => 11/08/2015 [7] => 12/08/2015 [8] => 13/08/2015 [9] => 14/08/2015 [10] => 15/08/2015 [11] => 16/08/2015 [12] => 17/08/2015 [13] => 18/08/2015 [14] => 19/08/2015 [15] => 20/08/2015 [16] => 21/08/2015 [17] => 22/08/2015 [18] => 23/08/2015 [19] => 24/08/2015 [20] => 25/08/2015 [21] => 26/08/2015 [22] => 27/08/2015 [23] => 28/08/2015 [24] => 29/08/2015 [25] => 30/08/2015 [26] => 31/08/2015 [27] => 01/09/2015 [28] => 02/09/2015 [29] => 03/09/2015 [30] => 04/09/2015 [31] => 05/09/2015 [32] => 06/09/2015 [33] => 07/09/2015 [34] => 08/09/2015 [35] => 09/09/2015 [36] => 10/09/2015 [37] => 11/09/2015 [38] => 12/09/2015 [39] => 13/09/2015 [40] => 14/09/2015 [41] => 15/09/2015 [42] => 16/09/2015 [43] => 17/09/2015 [44] => 18/09/2015 [45] => 19/09/2015 [46] => 20/09/2015 [47] => 21/09/2015 [48] => 22/09/2015 [49] => 23/09/2015 [50] => 24/09/2015 [51] => 25/09/2015 [52] => 26/09/2015 [53] => 27/09/2015 [54] => 28/09/2015 [55] => 29/09/2015 [56] => 30/09/2015 [57] => 01/10/2015 [58] => 02/10/2015 [59] => 03/10/2015 [60] => 04/10/2015 [61] => 05/10/2015 [62] => 06/10/2015 [63] => 07/10/2015 [64] => 08/10/2015 [65] => 09/10/2015 [66] => 10/10/2015 [67] => 11/10/2015 [68] => 12/10/2015 [69] => 13/10/2015 [70] => 14/10/2015 [71] => 15/10/2015 [72] => 16/10/2015 [73] => 17/10/2015 [74] => 18/10/2015 [75] => 19/10/2015 [76] => 20/10/2015 [77] => 21/10/2015 [78] => 22/10/2015 [79] => 23/10/2015 [80] => 24/10/2015 [81] => 25/10/2015 [82] => 26/10/2015 [83] => 27/10/2015 [84] => 28/10/2015 [85] => 29/10/2015 [86] => 30/10/2015 [87] => 31/10/2015 [88] => 01/11/2015 [89] => 02/11/2015 [90] => 03/11/2015 [91] => 04/11/2015 [92] => 05/11/2015 [93] => 06/11/2015 [94] => 07/11/2015 [95] => 08/11/2015 [96] => 09/11/2015 [97] => 10/11/2015 [98] => 11/11/2015 [99] => 12/11/2015 [100] => 13/11/2015 [101] => 14/11/2015 [102] => 15/11/2015 [103] => 16/11/2015 [104] => 17/11/2015 [105] => 18/11/2015 [106] => 19/11/2015 [107] => 20/11/2015 [108] => 21/11/2015 [109] => 22/11/2015 [110] => 23/11/2015 [111] => 24/11/2015 [112] => 25/11/2015 [113] => 26/11/2015 [114] => 27/11/2015 [115] => 28/11/2015 [116] => 29/11/2015 [117] => 30/11/2015 [118] => 01/12/2015 [119] => 02/12/2015 [120] => 03/12/2015 [121] => 04/12/2015 [122] => 05/12/2015 [123] => 06/12/2015 [124] => 07/12/2015 [125] => 08/12/2015 [126] => 09/12/2015 [127] => 10/12/2015 [128] => 11/12/2015 [129] => 12/12/2015 [130] => 13/12/2015 [131] => 14/12/2015 [132] => 15/12/2015 [133] => 16/12/2015 [134] => 17/12/2015 [135] => 18/12/2015 [136] => 19/12/2015 [137] => 20/12/2015 [138] => 21/12/2015 [139] => 22/12/2015 [140] => 23/12/2015 [141] => 24/12/2015 [142] => 25/12/2015 [143] => 26/12/2015 [144] => 27/12/2015 [145] => 28/12/2015 [146] => 29/12/2015 [147] => 30/12/2015 [148] => 31/12/2015 [149] => 01/01/2016 [150] => 02/01/2016 [151] => 03/01/2016 [152] => 04/01/2016 [153] => 05/01/2016 [154] => 06/01/2016 [155] => 07/01/2016 [156] => 08/01/2016 [157] => 09/01/2016 [158] => 10/01/2016 [159] => 11/01/2016 [160] => 12/01/2016 [161] => 13/01/2016 [162] => 14/01/2016 [163] => 15/01/2016 [164] => 16/01/2016 [165] => 17/01/2016 [166] => 18/01/2016 [167] => 19/01/2016 [168] => 20/01/2016 [169] => 21/01/2016 [170] => 22/01/2016 [171] => 23/01/2016 [172] => 24/01/2016 [173] => 25/01/2016 [174] => 26/01/2016 [175] => 27/01/2016 [176] => 28/01/2016 [177] => 29/01/2016 [178] => 30/01/2016 [179] => 31/01/2016 [180] => 01/02/2016 [181] => 02/02/2016 [182] => 03/02/2016 [183] => 04/02/2016 [184] => 05/02/2016 [185] => 06/02/2016 [186] => 07/02/2016 [187] => 08/02/2016 [188] => 09/02/2016 [189] => 10/02/2016 [190] => 11/02/2016 [191] => 12/02/2016 [192] => 13/02/2016 [193] => 14/02/2016 [194] => 15/02/2016 [195] => 16/02/2016 [196] => 17/02/2016 [197] => 18/02/2016 [198] => 19/02/2016 [199] => 20/02/2016 [200] => 21/02/2016 [201] => 22/02/2016 [202] => 23/02/2016 [203] => 24/02/2016 [204] => 25/02/2016 [205] => 26/02/2016 [206] => 27/02/2016 [207] => 28/02/2016 [208] => 29/02/2016 [209] => 01/03/2016 [210] => 02/03/2016 [211] => 03/03/2016 [212] => 04/03/2016 [213] => 05/03/2016 [214] => 06/03/2016 [215] => 07/03/2016 [216] => 08/03/2016 [217] => 09/03/2016 [218] => 10/03/2016 [219] => 11/03/2016 [220] => 12/03/2016 [221] => 13/03/2016 [222] => 14/03/2016 [223] => 15/03/2016 [224] => 16/03/2016 [225] => 17/03/2016 [226] => 18/03/2016 [227] => 19/03/2016 [228] => 20/03/2016 [229] => 21/03/2016 [230] => 22/03/2016 [231] => 23/03/2016 [232] => 24/03/2016 [233] => 25/03/2016 [234] => 26/03/2016 [235] => 27/03/2016 [236] => 28/03/2016 [237] => 29/03/2016 [238] => 30/03/2016 [239] => 31/03/2016 [240] => 01/04/2016 [241] => 02/04/2016 [242] => 03/04/2016 [243] => 04/04/2016 [244] => 05/04/2016 [245] => 06/04/2016 [246] => 07/04/2016 [247] => 08/04/2016 [248] => 09/04/2016 [249] => 10/04/2016 [250] => 11/04/2016 [251] => 12/04/2016 [252] => 13/04/2016 [253] => 14/04/2016 [254] => 15/04/2016 [255] => 16/04/2016 [256] => 17/04/2016 [257] => 18/04/2016 [258] => 19/04/2016 [259] => 20/04/2016 [260] => 21/04/2016 [261] => 22/04/2016 [262] => 23/04/2016 [263] => 24/04/2016 [264] => 25/04/2016 [265] => 26/04/2016 [266] => 27/04/2016 [267] => 28/04/2016 [268] => 29/04/2016 [269] => 30/04/2016 [270] => 01/05/2016 [271] => 02/05/2016 [272] => 03/05/2016 [273] => 04/05/2016 [274] => 05/05/2016 [275] => 06/05/2016 [276] => 07/05/2016 [277] => 08/05/2016 [278] => 09/05/2016 [279] => 10/05/2016 [280] => 11/05/2016 [281] => 12/05/2016 [282] => 13/05/2016 [283] => 14/05/2016 [284] => 15/05/2016 [285] => 16/05/2016 [286] => 17/05/2016 [287] => 18/05/2016 [288] => 19/05/2016 [289] => 20/05/2016 [290] => 21/05/2016 [291] => 22/05/2016 [292] => 23/05/2016 [293] => 24/05/2016 [294] => 25/05/2016 [295] => 26/05/2016 [296] => 27/05/2016 [297] => 28/05/2016 [298] => 29/05/2016 [299] => 30/05/2016 [300] => 31/05/2016 [301] => 01/06/2016 [302] => 02/06/2016 [303] => 03/06/2016 [304] => 04/06/2016 [305] => 05/06/2016 [306] => 06/06/2016 [307] => 07/06/2016 [308] => 08/06/2016 [309] => 09/06/2016 [310] => 10/06/2016 [311] => 11/06/2016 [312] => 12/06/2016 [313] => 13/06/2016 [314] => 14/06/2016 [315] => 15/06/2016 [316] => 16/06/2016 [317] => 17/06/2016 [318] => 18/06/2016 [319] => 19/06/2016 [320] => 20/06/2016 [321] => 21/06/2016 [322] => 22/06/2016 [323] => 23/06/2016 [324] => 24/06/2016 [325] => 25/06/2016 [326] => 26/06/2016 [327] => 27/06/2016 [328] => 28/06/2016 [329] => 29/06/2016 [330] => 30/06/2016 [331] => 01/07/2016 [332] => 02/07/2016 [333] => 03/07/2016 [334] => 04/07/2016 [335] => 05/07/2016 )