3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new \DateTime('-4 month', new \DateTimeZone('GMT')); //echo $date->format('m-d-Y'); $quarter = ceil($date->format('n') / 3); $year = $date->format('Y'); $date = \DateTime::createFromFormat('Y-n-j H:i', strval($year+1)."-$month-1 00:00"); echo $date->format('d-m-Y H:i');
based on dkoGp
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: month in /in/jAMRU on line 8 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/jAMRU:10 Stack trace: #0 {main} thrown in /in/jAMRU on line 10
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: month in /in/jAMRU on line 8 Fatal error: Call to a member function format() on boolean in /in/jAMRU on line 10
Process exited with code 255.
Output for 5.3.22 - 5.5.35
Notice: Undefined variable: month in /in/jAMRU on line 8 Fatal error: Call to a member function format() on a non-object in /in/jAMRU on line 10
Process exited with code 255.