3v4l.org

run code in 300+ PHP versions simultaneously
<?php $updated_at = new DateTime('2014-06-01'); $today = new DateTime('now'); $interval = $updated_at->diff($today); echo $interval->format('%a');
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
110
Output for 7.0.6
702
Output for 7.0.5
671
Output for 7.0.4
648
Output for 7.0.3
656
Output for 7.0.2
659
Output for 7.0.1
661
Output for 7.0.0
664
Output for 5.6.21
700
Output for 5.6.20
678
Output for 5.6.19
644
Output for 5.6.18
652
Output for 5.6.17
657
Output for 5.6.16
665
Output for 5.6.15
666
Output for 5.6.14
670
Output for 5.6.13
683
Output for 5.6.12
688
Output for 5.6.11
691
Output for 5.6.10
693
Output for 5.6.9
696
Output for 5.6.8
698
Output for 5.6.7
723
Output for 5.5.35
721
Output for 5.5.34
679
Output for 5.5.33
646
Output for 5.5.32
654
Output for 5.5.31
658
Output for 5.5.30
669
Output for 5.5.29
685
Output for 5.5.28
689
Output for 5.5.27
690
Output for 5.5.26
694
Output for 5.5.25
697
Output for 5.5.24
699
Output for 5.4.45
469
Output for 5.4.41 - 5.4.44
440
Output for 5.4.39 - 5.4.40
341
Output for 5.4.38
274
Output for 5.4.36 - 5.4.37
252
Output for 5.4.34 - 5.4.35
186
Output for 5.3.29, 5.4.25 - 5.4.32
97
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/FHfNs on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/FHfNs on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/FHfNs on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/FHfNs on line 2

preferences:
275.78 ms | 401 KiB | 330 Q