3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d1 = new DateTime("2013-02-19"); $d2 = new DateTime("2015-02-04"); var_dump($d1->diff($d2)->m); var_dump($d1->diff($d2)->m + ($d1->diff($d2)->y*12));
based on EkRqT
Output for 5.3.0 - 7.1.0
int(11) int(23)
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/gp3Xi on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/gp3Xi on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/gp3Xi 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/gp3Xi on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/gp3Xi on line 8
Process exited with code 255.