3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date1 = new \DateTime(); $date2 = \DateTime::createFromFormat('Y-m-d', '2014-05-24'); 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(2)
Output for 7.0.6
int(710)
Output for 7.0.5
int(680)
Output for 7.0.4
int(656)
Output for 7.0.3
int(664)
Output for 7.0.2
int(669)
Output for 7.0.1
int(670)
Output for 7.0.0
int(673)
Output for hhvm-3.12.0
int(659)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.21
int(709)
Output for 5.6.20
int(687)
Output for 5.6.19
int(654)
Output for 5.6.18
int(661)
Output for 5.6.17
int(666)
Output for 5.6.16
int(674)
Output for 5.6.15
int(675)
Output for 5.6.14
int(679)
Output for 5.6.13
int(692)
Output for 5.6.12
int(697)
Output for 5.6.11
int(701)
Output for 5.6.10
int(702)
Output for 5.6.9
int(704)
Output for 5.6.8
int(707)
Output for 5.5.35
int(729)
Output for 5.5.34
int(688)
Output for 5.5.33
int(655)
Output for 5.5.32
int(663)
Output for 5.5.31
int(667)
Output for 5.5.30
int(678)
Output for 5.5.29
int(694)
Output for 5.5.28
int(698)
Output for 5.5.27
int(699)
Output for 5.5.26
int(703)
Output for 5.5.25
int(706)
Output for 5.5.24
int(731)
Output for 5.4.45
int(473)
Output for 5.4.44
int(460)
Output for 5.4.43
int(413)
Output for 5.4.42
int(401)
Output for 5.4.38 - 5.4.41
int(382)
Output for 5.4.36 - 5.4.37
int(260)
Output for 5.4.34 - 5.4.35
int(194)
Output for 5.3.29, 5.4.29 - 5.4.32
int(105)
Output for 5.2.10 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/XCkD2 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/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Fatal error: Call to undefined method DateTime::createfromformat() in /in/XCkD2 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/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Fatal error: Class 'DateTime' not found in /in/XCkD2 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/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/XCkD2 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/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/XCkD2 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/XCkD2 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XCkD2 on line 4 Parse error: parse error in /in/XCkD2 on line 6
Process exited with code 255.