3v4l.org

run code in 300+ PHP versions simultaneously
<?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'); //$monthEnd->setDate(2013, $month, 32); echo $monthEnd->format('jS, F Y'); echo "\r\n"; echo $monthEnd->getTimestamp(); echo "\r\n";
Output for 5.6.28, 7.0.12 - 7.0.20, 7.1.0 - 7.1.33, 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
05 1st, May 2013 1367396775 31st, May 2013 1369988775
Output for 7.0.6
05 1st, May 2013 1367379915 31st, May 2013 1369971915
Output for 7.0.5
05 1st, May 2013 1367427021 31st, May 2013 1370019021
Output for 7.0.4
05 1st, May 2013 1367376412 31st, May 2013 1369968412
Output for 7.0.3
05 1st, May 2013 1367377719 31st, May 2013 1369969719
Output for 7.0.2
05 1st, May 2013 1367415365 31st, May 2013 1370007365
Output for 7.0.1
05 1st, May 2013 1367417521 31st, May 2013 1370009521
Output for 7.0.0
05 1st, May 2013 1367423910 31st, May 2013 1370015910
Output for 5.6.21
05 1st, May 2013 1367362157 31st, May 2013 1369954157
Output for 5.6.20
05 1st, May 2013 1367410006 31st, May 2013 1370002006
Output for 5.6.19
05 1st, May 2013 1367376696 31st, May 2013 1369968696
Output for 5.6.18
05 1st, May 2013 1367423340 31st, May 2013 1370015340
Output for 5.6.17
05 1st, May 2013 1367393528 31st, May 2013 1369985528
Output for 5.6.16
05 1st, May 2013 1367430282 31st, May 2013 1370022282
Output for 5.6.15
05 1st, May 2013 1367433448 31st, May 2013 1370025448
Output for 5.6.14
05 1st, May 2013 1367442511 31st, May 2013 1370034511
Output for 5.6.13
05 1st, May 2013 1367370594 31st, May 2013 1369962594
Output for 5.6.12
05 1st, May 2013 1367419104 31st, May 2013 1370011104
Output for 5.6.11
05 1st, May 2013 1367444044 31st, May 2013 1370036044
Output for 5.6.10
05 1st, May 2013 1367364393 31st, May 2013 1369956393
Output for 5.6.9
05 1st, May 2013 1367382431 31st, May 2013 1369974431
Output for 5.6.8
05 1st, May 2013 1367410708 31st, May 2013 1370002708
Output for 5.6.7
05 1st, May 2013 1367374130 31st, May 2013 1369966130
Output for 5.5.35
05 1st, May 2013 1367375814 31st, May 2013 1369967814
Output for 5.5.34
05 1st, May 2013 1367431429 31st, May 2013 1370023429
Output for 5.5.33
05 1st, May 2013 1367415756 31st, May 2013 1370007756
Output for 5.5.32
05 1st, May 2013 1367436915 31st, May 2013 1370028915
Output for 5.5.31
05 1st, May 2013 1367403773 31st, May 2013 1369995773
Output for 5.5.30
05 1st, May 2013 1367440736 31st, May 2013 1370032736
Output for 5.5.29
05 1st, May 2013 1367421320 31st, May 2013 1370013320
Output for 5.5.28
05 1st, May 2013 1367430063 31st, May 2013 1370022063
Output for 5.5.27
05 1st, May 2013 1367438371 31st, May 2013 1370030371
Output for 5.5.26
05 1st, May 2013 1367373026 31st, May 2013 1369965026
Output for 5.5.25
05 1st, May 2013 1367394487 31st, May 2013 1369986487
Output for 5.5.24
05 1st, May 2013 1367419198 31st, May 2013 1370011198
Output for 5.4.45
05 1st, May 2013 1367380278 31st, May 2013 1369972278
Output for 5.4.44
05 1st, May 2013 1367380279 31st, May 2013 1369972279
Output for 5.4.41 - 5.4.43
05 1st, May 2013 1367380280 31st, May 2013 1369972280
Output for 5.4.40
05 1st, May 2013 1367380281 31st, May 2013 1369972281
Output for 5.4.37 - 5.4.39
05 1st, May 2013 1367380282 31st, May 2013 1369972282
Output for 5.4.35 - 5.4.36
05 1st, May 2013 1367380283 31st, May 2013 1369972283
Output for 5.4.32 - 5.4.34
05 1st, May 2013 1367380284 31st, May 2013 1369972284
Output for 5.3.29, 5.4.29 - 5.4.31
05 1st, May 2013 1367380285 31st, May 2013 1369972285
Output for 5.4.26 - 5.4.28
05 1st, May 2013 1367380286 31st, May 2013 1369972286
Output for 5.3.28, 5.4.23 - 5.4.25
05 1st, May 2013 1367380287 31st, May 2013 1369972287
Output for 5.4.19 - 5.4.22
05 1st, May 2013 1367380288 31st, May 2013 1369972288
Output for 5.3.27, 5.4.16 - 5.4.18
05 1st, May 2013 1367380289 31st, May 2013 1369972289
Output for 5.3.23 - 5.3.26, 5.4.13 - 5.4.15
05 1st, May 2013 1367380290 31st, May 2013 1369972290
Output for 5.3.20 - 5.3.22, 5.4.9 - 5.4.12
05 1st, May 2013 1367380291 31st, May 2013 1369972291
Output for 5.3.16 - 5.3.19, 5.4.6 - 5.4.8
05 1st, May 2013 1367380292 31st, May 2013 1369972292
Output for 5.3.12 - 5.3.15, 5.4.3 - 5.4.5
05 1st, May 2013 1367380293 31st, May 2013 1369972293
Output for 5.3.8 - 5.3.11, 5.4.0 - 5.4.2
05 1st, May 2013 1367380294 31st, May 2013 1369972294
Output for 5.3.4 - 5.3.7
05 1st, May 2013 1367380295 31st, May 2013 1369972295
Output for 5.3.0 - 5.3.3
05 1st, May 2013 1367380296 31st, May 2013 1369972296
Output for 5.2.0 - 5.2.17
05 1st, May 2013 Fatal error: Call to undefined method DateTime::getTimestamp() in /in/bpYvk on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
05 Fatal error: Class 'DateTime' not found in /in/bpYvk on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
05 Fatal error: Cannot instantiate non-existent class: datetime in /in/bpYvk on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
05 Fatal error: Cannot instantiate non-existent class: datetime in /in/bpYvk on line 11

preferences:
279.36 ms | 401 KiB | 358 Q