3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today = new DateTime(); $today->setTime(0,0,48); $issued = new DateTime(); $issued->setTime(0,0,0); $issued->sub(new DateInterval('P1D')); $diff = $issued->diff($today); /* $voidable */ /* $voidable */ /*echo "<pre>"; print_r($today); print_r($issued); var_dump($diff); echo "</pre>";*/ var_dump(($today->format('Y-m-d') == $issued->format('Y-m-d')) or ($diff->d == 1 and $diff->h < 3));
Output for 5.3.3 - 7.1.0
bool(true)
Output for 5.3.0 - 5.3.2
bool(false)
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::sub() in /in/RKjq5 on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/RKjq5 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/RKjq5 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/RKjq5 on line 2