3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nowdate = new DateTime('now'); $thendate = new DateTime('2012-04-01'); $diff = $nowdate->diff($thendate)->format("%a"); echo $diff;
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19, 5.6.28, 7.0.14 - 7.1.0
537
Output for 7.0.6
1493
Output for 7.0.5
1462
Output for 7.0.4
1439
Output for 7.0.3
1447
Output for 7.0.2
1450
Output for 7.0.1
1452
Output for 7.0.0
1455
Output for 5.5.30, hhvm-3.12.0
1460
Output for hhvm-3.10.0
1458
Output for 5.6.21
1491
Output for 5.6.20
1469
Output for 5.6.19
1436
Output for 5.6.18
1443
Output for 5.6.17
1448
Output for 5.6.16
1456
Output for 5.6.15
1457
Output for 5.6.14
1461
Output for 5.6.13
1475
Output for 5.6.12
1479
Output for 5.6.11
1482
Output for 5.6.10
1484
Output for 5.6.9
1487
Output for 5.6.8
1489
Output for 5.6.7
1514
Output for 5.5.35
1512
Output for 5.5.34
1470
Output for 5.5.33
1437
Output for 5.5.32
1445
Output for 5.5.31
1449
Output for 5.5.29
1476
Output for 5.5.28
1480
Output for 5.5.27
1481
Output for 5.5.26
1486
Output for 5.5.25
1488
Output for 5.5.24
1490
Output for 5.4.45
1268
Output for 5.4.43 - 5.4.44
1227
Output for 5.4.42
1193
Output for 5.4.39 - 5.4.41
1139
Output for 5.4.38
1066
Output for 5.4.34 - 5.4.37
1044
Output for 5.3.28 - 5.3.29, 5.4.20 - 5.4.32
892
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/0j2N5 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/0j2N5 on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/0j2N5 on line 4
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/0j2N5 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0j2N5 on line 4
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/mdoj4 on line 4
Process exited with code 255.