3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lastmonday = strtotime('last monday of this month'); echo date('Y-m-d',$lastmonday); $firstday = strtotime('first day of this month'); echo date('Y-m-d',$firstday); $d1 = new DateTime($lastmonday); $dd1 = $d1->format('Y-m-d'); $d2 = new DateTime($firstday); $dd2 = $d2->format('Y-m-d'); $period_serv = $dd1->diff($dd2); $theperiod = $period_serv->format('%a'); echo $theperiod;
Output for 8.3.0 - 8.3.6
2015-10-262015-10-01 Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (1445814000) at position 8 (0): Unexpected character in /in/WJbBm:13 Stack trace: #0 /in/WJbBm(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/WJbBm on line 13
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
2015-10-262015-10-01 Fatal error: Uncaught Exception: Failed to parse time string (1445814000) at position 8 (0): Unexpected character in /in/WJbBm:13 Stack trace: #0 /in/WJbBm(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/WJbBm on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
2015-10-262015-10-01 Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (1445814000) at position 8 (0): Unexpected character in /in/WJbBm:13 Stack trace: #0 /in/WJbBm(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/WJbBm on line 13
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26, 8.0.13
2015-10-262015-10-01 Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (1445817600) at position 8 (0): Unexpected character in /in/WJbBm:13 Stack trace: #0 /in/WJbBm(13): DateTime->__construct('1445817600') #1 {main} thrown in /in/WJbBm on line 13
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
2015-10-262015-10-01 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1445814000) at position 8 (0): Unexpected character' in /in/WJbBm:13 Stack trace: #0 /in/WJbBm(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/WJbBm on line 13
Process exited with code 255.

preferences:
240.3 ms | 402 KiB | 314 Q