3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // PHP BUG // TESTED IN // PHP 5.3.27 (cli) (built: Oct 23 2013 15:35:54) // Copyright (c) 1997-2013 The PHP Group // Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies // PHP 5.5.16-pl0-gentoo (cli) (built: Sep 30 2014 10:51:53) // Copyright (c) 1997-2014 The PHP Group // Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies // with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies $now1 = new DateTime(); $now2 = new DateTime(); $now2->sub(new \DateInterval('P1D')); echo $now1->getTimestamp() - $now2->getTimestamp(); // output: 90000 $now1 = new DateTime(); $now2 = new DateTime(); $now2->sub(new \DateInterval('P2D')); echo $now1->getTimestamp() - $now2->getTimestamp(); // output: 176400 // NOT APPEARING IN // PHP 5.3.10-1ubuntu3.13 with Suhosin-Patch (cli) (built: Jul 7 2014 18:54:55) // Copyright (c) 1997-2012 The PHP Group // Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies // with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Output for 5.3.3 - 5.6.14, 5.6.17 - 7.1.0
86400172800
Output for 5.6.16
82800169200
Output for 5.6.15
86400169200
Output for 5.3.0 - 5.3.2
172800345600
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 21 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 29 Fatal error: Call to undefined method DateTime::sub() in /in/ZDqGM on line 21
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 21 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 29 Fatal error: Class 'DateTime' not found in /in/ZDqGM on line 19
Process exited with code 255.
Output for 5.1.0
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 21 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 29 Fatal error: fatal flex scanner internal error--end of buffer missed in /in/ZDqGM on line 41
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 21 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 29 Fatal error: Cannot instantiate non-existent class: datetime in /in/ZDqGM on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 21 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZDqGM on line 29 Fatal error: Cannot instantiate non-existent class: datetime in /in/ZDqGM on line 19