3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date1 = new \DateTime(); $date2 = \DateTime::createFromFormat('Y-m-d', '2014-05-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(1)
Output for 7.0.6
int(711)
Output for 7.0.5
int(680)
Output for 7.0.4
int(657)
Output for 7.0.3
int(665)
Output for 7.0.2
int(668)
Output for 7.0.1
int(670)
Output for 7.0.0
int(673)
Output for 5.6.21
int(709)
Output for 5.6.20
int(687)
Output for 5.6.19
int(653)
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(700)
Output for 5.6.10
int(702)
Output for 5.6.9
int(705)
Output for 5.6.8
int(707)
Output for 5.6.7
int(732)
Output for 5.5.35
int(730)
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(708)
Output for 5.4.45
int(478)
Output for 5.4.41 - 5.4.44
int(449)
Output for 5.4.39 - 5.4.40
int(350)
Output for 5.4.38
int(283)
Output for 5.4.36 - 5.4.37
int(261)
Output for 5.4.34 - 5.4.35
int(195)
Output for 5.3.29, 5.4.29 - 5.4.32
int(106)
Output for 5.2.10 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/p4GJp 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/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Fatal error: Call to undefined method DateTime::createfromformat() in /in/p4GJp 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/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Fatal error: Class 'DateTime' not found in /in/p4GJp 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/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/p4GJp 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/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/p4GJp 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/p4GJp on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/p4GJp on line 4 Parse error: parse error in /in/p4GJp on line 6
Process exited with code 255.