3v4l.org

run code in 300+ PHP versions simultaneously
<?php class JhDateTime extends DateTime {} $date1 = new JhDateTime("10 September 2014"); $date2 = new JhDateTime("17 September 2014"); $period = new \DatePeriod( $date1 , new \DateInterval("P1M"), $date2 ); foreach($period as $date) { var_dump(get_class($date)); }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 8.0.22 - 8.0.30, 8.1.9 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
string(8) "DateTime"
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.21, 8.1.0 - 8.1.8
string(10) "JhDateTime"
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 13 Fatal error: Class 'DatePeriod' not found in /in/DQShV on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 13 Fatal error: Class 'DateTime' not found in /in/DQShV on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 13 Fatal error: Class jhdatetime: Cannot inherit from undefined class datetime in /in/DQShV on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/DQShV on line 13 Fatal error: Class jhdatetime: Cannot inherit from undefined class datetime in /in/DQShV on line 4

preferences:
228.26 ms | 402 KiB | 357 Q