3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d1 = new DateTime("2009-09-01"); $d2 = new DateTime("2010-05-01"); var_dump($d1->diff($d2)->m); var_dump($d1->diff($d2)->y); // int(4)
based on 8dETa
Output for 5.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
int(7) int(0)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/ihBLt on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/ihBLt on line 4
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/ihBLt on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/ihBLt on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/ihBLt on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ihBLt on line 8
Process exited with code 255.