3v4l.org

run code in 300+ PHP versions simultaneously
<?php $today = new DateTime(); $currentLocationTime = new DateTime( '2014-08-01 16:27:33' ); //formatting date time string to date $gap = date_diff( $today, $currentLocationTime )->days; echo $gap; ?>
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.32, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 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
31
Output for 7.0.6
640
Output for 7.0.5
610
Output for 7.0.4
586
Output for 7.0.3
595
Output for 7.0.2
599
Output for 7.0.1
600
Output for 7.0.0
603
Output for 5.6.21
639
Output for 5.6.20
617
Output for 5.6.19
584
Output for 5.6.18
591
Output for 5.6.17
596
Output for 5.6.16
604
Output for 5.6.15
605
Output for 5.6.14
609
Output for 5.6.13
622
Output for 5.6.12
627
Output for 5.6.11
630
Output for 5.6.10
632
Output for 5.6.9
635
Output for 5.6.8
637
Output for 5.5.35
659
Output for 5.5.34
618
Output for 5.5.33
585
Output for 5.5.32
593
Output for 5.5.31
597
Output for 5.5.30
608
Output for 5.5.29
624
Output for 5.5.28
628
Output for 5.5.27
629
Output for 5.5.26
633
Output for 5.5.25
636
Output for 5.5.24
661
Output for 5.4.45
399
Output for 5.4.39 - 5.4.44
379
Output for 5.4.34 - 5.4.38
215
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined function date_diff() in /in/3alGC 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/3alGC 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/3alGC on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/3alGC on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/3alGC on line 4
Process exited with code 255.

preferences:
214.41 ms | 401 KiB | 312 Q