3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $month = $dateParts[0]; $day = $dateParts[1]; $year = $dateParts[2]; $dateString = $month . $day . $year; $exp = new DateTime($dateString); $now = new DateTime(); if ( $exp < $now ) echo "in future"; else echo "in past";
Output for 7.1.0
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 in future
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.0.14
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 in past
Output for 5.0.4 - 5.1.6
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 Fatal error: Class 'DateTime' not found in /in/90diS on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 Fatal error: Class 'DateTime' not found in /in/90diS on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/90diS on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: dateParts in /in/90diS on line 3 Notice: Undefined variable: dateParts in /in/90diS on line 4 Notice: Undefined variable: dateParts in /in/90diS on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/90diS on line 7