3v4l.org

run code in 200+ PHP versions simultaneously
<?php if (function_exists('date_default_timezone_set')) date_default_timezone_set("UTC"); echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019W14")) . " should be 2019-04-01\n"; echo date("Y-m-d H:i:s", strtotime("2019W15")) . " should be 2019-04-08\n"; echo date("Y-m-d H:i:s", strtotime("2019W16")) . " should be 2019-04-15\n\n"; echo "off by one:\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next tuesday")) . " should be 2019-04-16\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next wednesday")) . " should be 2019-04-17\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next thursday")) . " should be 2019-04-18\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next saturday")) . " should be 2019-04-20\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next sunday")) . " should be 2019-04-21\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next monday")) . " should be 2019-04-22\n\n"; echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next monday")) . " should be 2019-04-22\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next thursday")) . " should be 2019-04-18\n";
based on oJ5aQ
Output for 5.2.0 - 7.4.0
works as expected: 2019-04-01 00:00:00 should be 2019-04-01 2019-04-08 00:00:00 should be 2019-04-08 2019-04-15 00:00:00 should be 2019-04-15 off by one: 2019-04-22 00:00:00 should be 2019-04-16 2019-04-16 00:00:00 should be 2019-04-17 2019-04-17 00:00:00 should be 2019-04-18 2019-04-18 00:00:00 should be 2019-04-19 2019-04-19 00:00:00 should be 2019-04-20 2019-04-20 00:00:00 should be 2019-04-21 2019-04-21 00:00:00 should be 2019-04-22 works as expected: 2019-04-22 00:00:00 should be 2019-04-22 2019-04-19 00:00:00 should be 2019-04-19 2019-04-18 00:00:00 should be 2019-04-18
Output for 5.1.0 - 5.1.6
works as expected: 2019-04-01 00:00:00 should be 2019-04-01 2019-04-08 00:00:00 should be 2019-04-08 2019-04-15 00:00:00 should be 2019-04-15 off by one: 2019-04-16 00:00:00 should be 2019-04-16 2019-04-17 00:00:00 should be 2019-04-17 2019-04-18 00:00:00 should be 2019-04-18 2019-04-19 00:00:00 should be 2019-04-19 2019-04-20 00:00:00 should be 2019-04-20 2019-04-21 00:00:00 should be 2019-04-21 2019-04-22 00:00:00 should be 2019-04-22 works as expected: 2019-04-22 00:00:00 should be 2019-04-22 2019-04-19 00:00:00 should be 2019-04-19 2019-04-18 00:00:00 should be 2019-04-18
Output for 5.0.0 - 5.0.5
works as expected: 2019-01-03 00:00:00 should be 2019-04-01 2019-01-04 00:00:00 should be 2019-04-08 2019-01-05 00:00:00 should be 2019-04-15 off by one: 2019-01-05 00:00:00 should be 2019-04-16 2019-01-05 00:00:00 should be 2019-04-17 2019-01-05 00:00:00 should be 2019-04-18 2019-01-05 00:00:00 should be 2019-04-19 2019-01-05 00:00:00 should be 2019-04-20 2019-01-05 00:00:00 should be 2019-04-21 2019-01-05 00:00:00 should be 2019-04-22 works as expected: 2019-04-15 00:00:00 should be 2019-04-22 2019-04-15 00:00:00 should be 2019-04-19 2019-04-15 00:00:00 should be 2019-04-18
Output for 4.3.0 - 4.4.9
works as expected: 1970-01-01 00:59:59 should be 2019-04-01 1970-01-01 00:59:59 should be 2019-04-08 1970-01-01 00:59:59 should be 2019-04-15 off by one: 1970-01-01 00:59:59 should be 2019-04-16 1970-01-01 00:59:59 should be 2019-04-17 1970-01-01 00:59:59 should be 2019-04-18 1970-01-01 00:59:59 should be 2019-04-19 1970-01-01 00:59:59 should be 2019-04-20 1970-01-01 00:59:59 should be 2019-04-21 1970-01-01 00:59:59 should be 2019-04-22 works as expected: 2019-04-15 00:00:00 should be 2019-04-22 2019-04-15 00:00:00 should be 2019-04-19 2019-04-15 00:00:00 should be 2019-04-18