3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today = new DateTime(); $currentLocationTime = new DateTime( '2014-08-02 16:27:33' ); //formatting date time string to date $gap = date_diff( $today, $currentLocationTime )->days; echo $gap; ?>
based on 3alGC
Output for 5.6.28, 7.0.14 - 7.1.0
30
Output for 7.0.6
640
Output for 7.0.5
609
Output for 7.0.4
586
Output for 7.0.3
594
Output for 7.0.2
598
Output for 7.0.1
599
Output for 7.0.0
602
Output for 5.6.21
638
Output for 5.6.20
616
Output for 5.6.19
583
Output for 5.6.18
590
Output for 5.6.17
595
Output for 5.6.16
603
Output for 5.6.15
604
Output for 5.6.14
608
Output for 5.6.13
621
Output for 5.6.12
626
Output for 5.6.11
630
Output for 5.6.10
631
Output for 5.6.9
634
Output for 5.6.8
636
Output for 5.5.35
659
Output for 5.5.34
617
Output for 5.5.33
584
Output for 5.5.32
592
Output for 5.5.31
596
Output for 5.5.30
607
Output for 5.5.29
623
Output for 5.5.28
627
Output for 5.5.27
628
Output for 5.5.26
633
Output for 5.5.25
635
Output for 5.5.24
660
Output for 5.3.0 - 5.4.45
475
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined function date_diff() in /in/UmWHL on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/UmWHL 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/UmWHL on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/UmWHL on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/UmWHL on line 4
Process exited with code 255.