3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $raw_date = REQUEST_TIME; $midnight = new \DateTime(); $midnight->setTimestamp($raw_date)->modify('tomorrow')->setTime(0, 0); var_dump($midnight);
based on 1vAJT
Output for 7.2.0
Warning: Use of undefined constant REQUEST_TIME - assumed 'REQUEST_TIME' (this will throw an Error in a future version of PHP) in /in/KEm7Y on line 2 Warning: DateTime::setTimestamp() expects parameter 1 to be integer, string given in /in/KEm7Y on line 4 Fatal error: Uncaught Error: Call to a member function modify() on boolean in /in/KEm7Y:4 Stack trace: #0 {main} thrown in /in/KEm7Y on line 4
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant REQUEST_TIME - assumed 'REQUEST_TIME' in /in/KEm7Y on line 2 Warning: DateTime::setTimestamp() expects parameter 1 to be integer, string given in /in/KEm7Y on line 4 Fatal error: Uncaught Error: Call to a member function modify() on boolean in /in/KEm7Y:4 Stack trace: #0 {main} thrown in /in/KEm7Y on line 4
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Notice: Use of undefined constant REQUEST_TIME - assumed 'REQUEST_TIME' in /in/KEm7Y on line 2 Warning: DateTime::setTimestamp() expects parameter 1 to be long, string given in /in/KEm7Y on line 4 Fatal error: Call to a member function modify() on boolean in /in/KEm7Y on line 4
Process exited with code 255.
Output for 5.3.18 - 5.5.35
Notice: Use of undefined constant REQUEST_TIME - assumed 'REQUEST_TIME' in /in/KEm7Y on line 2 Warning: DateTime::setTimestamp() expects parameter 1 to be long, string given in /in/KEm7Y on line 4 Fatal error: Call to a member function modify() on a non-object in /in/KEm7Y on line 4
Process exited with code 255.