3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_one_month($date) { // find the next month $nextmonth = mktime(0, 0, 0, date("n", $date) + 1, 1, date("Y", $date)); // limit the day number according to the month $day = min(date("t", $nextmonth), date("j", $date)); // combine into desired date return mktime(0, 0, 0, date("n", $nextmonth), $day, date("Y", $nextmonth)); } for ($d = 20; $d <= 31; $d++) { $date = mktime(0, 0, 0, 1, $d, 2017); $normal = date("Y-m-d", strtotime("+1 month", $date)); $addonemonth = date("Y-m-d", add_one_month($date)); printf("2017-01-%02d: +1 month = %s add_one_month = %s\n", $d, $normal, $addonemonth); }
Output for git.master, git.master_jit, rfc.property-hooks
2017-01-20: +1 month = 2017-02-20 add_one_month = 2017-02-20 2017-01-21: +1 month = 2017-02-21 add_one_month = 2017-02-21 2017-01-22: +1 month = 2017-02-22 add_one_month = 2017-02-22 2017-01-23: +1 month = 2017-02-23 add_one_month = 2017-02-23 2017-01-24: +1 month = 2017-02-24 add_one_month = 2017-02-24 2017-01-25: +1 month = 2017-02-25 add_one_month = 2017-02-25 2017-01-26: +1 month = 2017-02-26 add_one_month = 2017-02-26 2017-01-27: +1 month = 2017-02-27 add_one_month = 2017-02-27 2017-01-28: +1 month = 2017-02-28 add_one_month = 2017-02-28 2017-01-29: +1 month = 2017-03-01 add_one_month = 2017-02-28 2017-01-30: +1 month = 2017-03-02 add_one_month = 2017-02-28 2017-01-31: +1 month = 2017-03-03 add_one_month = 2017-02-28

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:
113.71 ms | 407 KiB | 5 Q