3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //echo (new DateTime())->format('Y-m-d'); //$azi = date('Y-m-d'); //$azi->sub(new DateInterval('P5D')); //$lead_time= (new DateTime('2014-09-05 13:18:26'))->format('Y-m-d'); $azi = new DateTime(); $azi->sub(new DateInterval('P5D')); $lead_time= new DateTime('2014-09-05 13:18:26'); echo $azi->format('Y-m-d') . "\n"; echo "<br>"; echo $lead_time->format('Y-m-d') . "\n"; if($lead_time<$azi){ // Leaduri mai vechi $l_class=""; }else{ // Leaduri Fresh $l_class="fresh_leads"; echo "Fresh"; } /* $azi->sub(new DateInterval('P5D')); echo $azi; */
based on qp8Gc
Output for 5.3.0 - 5.6.30, hhvm-3.11.1, hhvm-3.13.2, hhvm-3.17.3, 7.0.0 - 7.2.0
2014-09-05 <br>2014-09-05 Fresh
Output for hhvm-3.10.1, hhvm-3.12.14, hhvm-3.15.4

Process exited with code 137.
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::sub() in /in/Kci3K on line 10
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Kci3K on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/Kci3K on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/Kci3K on line 9