3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $time=-62167046400; // 0000-01-03 0-01-1 var_dump(date('Y-m-d o-W-N', $time - 86400)); var_dump(date('Y-m-d o-W-N', $time - 86400 * 2)); var_dump(date('Y-m-d o-W-N', $time - 86400 * 3), 'The issue appeared here. Expected: 0000-01-02 -1-52-5'); var_dump(date('Y-m-d o-W-N', $time - 86400 * 4)); var_dump(date('Y-m-d o-W-N', $time - 86400 * 5));
Output for 5.6.4 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.21, 7.4.0 - 7.4.9, 8.0.0alpha1 - beta1
string(18) "0000-01-02 -1-52-7" string(18) "0000-01-01 -1-52-6" string(19) "-0001-12-31 -1-53-4" string(53) "The issue appeared here. Expected: 0000-01-02 -1-52-5" string(19) "-0001-12-30 -1-53-3" string(19) "-0001-12-29 -1-53-2"
Output for 5.6.0 - 5.6.3
string(18) "0000-01-02 -1-52-7" string(18) "0000-01-01 -1-52-6" string(19) "-0001-12-31 -1-52-6" string(53) "The issue appeared here. Expected: 0000-01-02 -1-52-5" string(19) "-0001-12-30 -1-52-5" string(19) "-0001-12-29 -1-52-4"