3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $month = 5; $month = sprintf("%02d", $month); echo $month; echo "\r\n"; $monthStart = new DateTime(); $monthStart->setDate(2013, $month, 01); echo $monthStart->format('jS, F Y'); echo "\r\n"; echo $monthStart->getTimestamp(); echo "\r\n"; $monthEnd = $monthStart->modify('+1 month -1 day'); echo $monthEnd->format('jS, F Y'); echo "\r\n"; echo $monthEnd->getTimestamp(); echo "\r\n";
Output for 5.6.28, 7.0.14 - 7.1.0
05 1st, May 2013 1367397196 31st, May 2013 1369989196
Output for 7.0.6
05 1st, May 2013 1367423030 31st, May 2013 1370015030
Output for 5.5.34, 5.6.20, 7.0.5
05 1st, May 2013 1367423294 31st, May 2013 1370015294
Output for 5.5.32 - 5.5.33, 5.6.18 - 5.6.19, hhvm-3.12.0, 7.0.4
05 1st, May 2013 1367423295 31st, May 2013 1370015295
Output for 5.5.31, 5.6.17, 7.0.1 - 7.0.3
05 1st, May 2013 1367423296 31st, May 2013 1370015296
Output for 5.5.30, 5.6.13 - 5.6.16, hhvm-3.10.0, 7.0.0
05 1st, May 2013 1367423297 31st, May 2013 1370015297
Output for 5.6.21
05 1st, May 2013 1367405642 31st, May 2013 1369997642
Output for 5.5.28 - 5.5.29, 5.6.12
05 1st, May 2013 1367423298 31st, May 2013 1370015298
Output for 5.5.26 - 5.5.27, 5.6.9 - 5.6.11
05 1st, May 2013 1367423299 31st, May 2013 1370015299
Output for 5.5.24 - 5.5.25, 5.6.7 - 5.6.8
05 1st, May 2013 1367423300 31st, May 2013 1370015300
Output for 5.5.21 - 5.5.23, 5.6.6
05 1st, May 2013 1367423301 31st, May 2013 1370015301
Output for 5.5.19 - 5.5.20, 5.6.3 - 5.6.5
05 1st, May 2013 1367423302 31st, May 2013 1370015302
Output for 5.5.16 - 5.5.18, 5.6.0 - 5.6.2
05 1st, May 2013 1367423303 31st, May 2013 1370015303
Output for 5.5.35
05 1st, May 2013 1367427838 31st, May 2013 1370019838
Output for 5.5.13 - 5.5.15
05 1st, May 2013 1367423304 31st, May 2013 1370015304
Output for 5.5.10 - 5.5.12
05 1st, May 2013 1367423305 31st, May 2013 1370015305
Output for 5.5.6 - 5.5.9
05 1st, May 2013 1367423306 31st, May 2013 1370015306
Output for 5.5.3 - 5.5.5
05 1st, May 2013 1367423307 31st, May 2013 1370015307
Output for 5.5.0 - 5.5.2
05 1st, May 2013 1367423308 31st, May 2013 1370015308
Output for 5.4.0 - 5.4.45
05 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /in/skrFP:11 Stack trace: #0 /in/skrFP(11): DateTime->__construct() #1 {main} thrown in /in/skrFP on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.29
05 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead' in /in/skrFP:11 Stack trace: #0 /in/skrFP(11): DateTime->__construct() #1 {main} thrown in /in/skrFP on line 11
Process exited with code 255.
Output for 5.2.3 - 5.2.17
05 1st, May 2013 Fatal error: Call to undefined method DateTime::getTimestamp() in /in/skrFP on line 16
Process exited with code 255.
Output for 5.2.0 - 5.2.2
05 1st, May 2013 <br /> <b>Fatal error</b>: Call to undefined method DateTime::getTimestamp() in <b>/in/skrFP</b> on line <b>16</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.1.6
05 <br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/skrFP</b> on line <b>11</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
05 <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/skrFP</b> on line <b>11</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
05 <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/skrFP</b> on line <b>11</b><br />