3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); $d2 = new DateTime($firstday); $period_serv = $d1->diff($d2); $theperiod = $period_serv->format('%a'); echo $theperiod;
based on LNDc0R
Output for 7.0.0 - 7.2.0
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/JpEjM:13 Stack trace: #0 /in/JpEjM(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/JpEjM on line 13
Process exited with code 255.
Output for 5.4.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/JpEjM:13 Stack trace: #0 /in/JpEjM(13): DateTime->__construct('1445814000') #1 {main} thrown in /in/JpEjM on line 13
Process exited with code 255.