3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date1 = new \DateTime(); $date2 = \DateTime::createFromFormat('Y-m-d', '2014-06-23'); var_dump($date2->diff($date1)->days);
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28, 5.6.28, 7.0.14 - 7.1.0
int(32)
Output for 7.0.6
int(680)
Output for 7.0.5
int(649)
Output for 7.0.4
int(626)
Output for 7.0.3
int(634)
Output for 7.0.2
int(637)
Output for 7.0.1
int(639)
Output for 7.0.0
int(642)
Output for 5.6.21
int(678)
Output for 5.6.20
int(656)
Output for 5.6.19
int(622)
Output for 5.6.18
int(630)
Output for 5.6.17
int(635)
Output for 5.6.16
int(643)
Output for 5.6.15
int(644)
Output for 5.6.14
int(648)
Output for 5.6.13
int(661)
Output for 5.6.12
int(666)
Output for 5.6.11
int(669)
Output for 5.6.10
int(671)
Output for 5.6.9
int(674)
Output for 5.6.8
int(676)
Output for 5.6.7
int(701)
Output for 5.5.35
int(699)
Output for 5.5.34
int(657)
Output for 5.5.33
int(624)
Output for 5.5.32
int(632)
Output for 5.5.31
int(636)
Output for 5.5.30
int(647)
Output for 5.5.29
int(663)
Output for 5.5.28
int(667)
Output for 5.5.27
int(668)
Output for 5.5.26
int(672)
Output for 5.5.25
int(675)
Output for 5.5.24
int(677)
Output for 5.4.45
int(447)
Output for 5.4.41 - 5.4.44
int(418)
Output for 5.4.39 - 5.4.40
int(319)
Output for 5.4.38
int(252)
Output for 5.4.36 - 5.4.37
int(230)
Output for 5.4.34 - 5.4.35
int(164)
Output for 5.3.29, 5.4.29 - 5.4.32
int(75)
Output for 5.2.10 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/XBLGr on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Fatal error: Call to undefined method DateTime::createfromformat() in /in/XBLGr on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Fatal error: Class 'DateTime' not found in /in/XBLGr on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/XBLGr on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/XBLGr on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XBLGr on line 4 Parse error: parse error in /in/XBLGr on line 6
Process exited with code 255.