3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateInput = DateTime::createFromFormat('ymd', '170621'); $now = new Datetime(); $lastWeek = new DateTime("-1 week"); var_dump($dateInput); var_dump($lastWeek); var_dump($dateInput >= $lastWeek && $now >= $dateInput);
based on K9Hm1
Output for 7.3.0alpha1
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.011424" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.2.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.004928" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.2.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.004063" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.003424" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.002606" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.023024" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.016559" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.017447" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.018092" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.005294" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:27.025811" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for hhvm-3.15.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-06-21 08:45:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-22 08:45:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)