3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(get_thirty_days(new \DateTime())); print_r(get_thirty_days(new \DateTime('2017-01-15'), 40)); print_r(array_reverse(get_thirty_days(new \DateTime('2017-01-15'), 10))); function get_thirty_days(\DateTime $date_in, int $days = null) { $days = $days ?? 30; $date_out = $date_in->add(new \DateInterval(sprintf('P%dD', $days))); $dates = []; while ($days) { $dates[] = $date_out ->sub(new \DateInterval('P1D')) ->format('Ymd') ; $days--; } return $dates; }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 20180130 [1] => 20180129 [2] => 20180128 [3] => 20180127 [4] => 20180126 [5] => 20180125 [6] => 20180124 [7] => 20180123 [8] => 20180122 [9] => 20180121 [10] => 20180120 [11] => 20180119 [12] => 20180118 [13] => 20180117 [14] => 20180116 [15] => 20180115 [16] => 20180114 [17] => 20180113 [18] => 20180112 [19] => 20180111 [20] => 20180110 [21] => 20180109 [22] => 20180108 [23] => 20180107 [24] => 20180106 [25] => 20180105 [26] => 20180104 [27] => 20180103 [28] => 20180102 [29] => 20180101 ) Array ( [0] => 20170223 [1] => 20170222 [2] => 20170221 [3] => 20170220 [4] => 20170219 [5] => 20170218 [6] => 20170217 [7] => 20170216 [8] => 20170215 [9] => 20170214 [10] => 20170213 [11] => 20170212 [12] => 20170211 [13] => 20170210 [14] => 20170209 [15] => 20170208 [16] => 20170207 [17] => 20170206 [18] => 20170205 [19] => 20170204 [20] => 20170203 [21] => 20170202 [22] => 20170201 [23] => 20170131 [24] => 20170130 [25] => 20170129 [26] => 20170128 [27] => 20170127 [28] => 20170126 [29] => 20170125 [30] => 20170124 [31] => 20170123 [32] => 20170122 [33] => 20170121 [34] => 20170120 [35] => 20170119 [36] => 20170118 [37] => 20170117 [38] => 20170116 [39] => 20170115 ) Array ( [0] => 20170115 [1] => 20170116 [2] => 20170117 [3] => 20170118 [4] => 20170119 [5] => 20170120 [6] => 20170121 [7] => 20170122 [8] => 20170123 [9] => 20170124 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
71.11 ms | 411 KiB | 5 Q