3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = strtotime(date('Y-m').'-01'); echo date('Y-m-d',$time); echo '<br>'.$final = date("Y-t-d", strtotime("-1 month", $time)); echo date('m-01-Y 00:00:00',strtotime('this month')) . '<br/>'; echo date('m-t-Y 12:59:59',strtotime('this month')) . '<br/>'; echo '<br>'.$current_month_start_day = strtotime(date('Y-m').'-01'); echo '<br>'.$prev_month_start_day = date("d.m.Y", strtotime("-1 month", $current_month_start_day)); echo '<br>'.$_REQUEST['date_start'] = $prev_month_start_day; // 01.12.2013 echo '<br>'.$_EQUEST['date_end'] = date("t.m.Y", strtotime("-1 month", $current_month_start_day)); // 31.12.2013 echo '-----------------'; $current_month_start_day = strtotime(date('Y-m') . '-01'); echo '<br>'.$_REQUEST['date_start'] = date("d.m.Y", date("d.m.Y", strtotime("-1 month", $current_month_start_day))); // 01.12.2013 echo '<br>'.$_REQUEST['date_end'] = date("t.m.Y", date("t.m.Y", strtotime("-1 month", $current_month_start_day))); // 31.12.2013
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2013-08-01<br>2013-31-0108-01-2013 00:00:00<br/>08-31-2013 12:59:59<br/><br>1375308000<br>01.07.2013<br>01.07.2013<br>31.07.2013----------------- Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /in/3icpo:19 Stack trace: #0 /in/3icpo(19): date('d.m.Y', '01.07.2013') #1 {main} thrown in /in/3icpo on line 19
Process exited with code 255.
Output for 8.0.13
2013-08-01<br>2013-31-0108-01-2013 00:00:00<br/>08-31-2013 12:59:59<br/><br>1375315200<br>01.07.2013<br>01.07.2013<br>31.07.2013----------------- Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /in/3icpo:19 Stack trace: #0 /in/3icpo(19): date('d.m.Y', '01.07.2013') #1 {main} thrown in /in/3icpo on line 19
Process exited with code 255.
Output for 5.1.1 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
2013-08-01<br>2013-31-0108-01-2013 00:00:00<br/>08-31-2013 12:59:59<br/><br>1375308000<br>01.07.2013<br>01.07.2013<br>31.07.2013----------------- Notice: A non well formed numeric value encountered in /in/3icpo on line 19 <br>01.01.1970 Notice: A non well formed numeric value encountered in /in/3icpo on line 20 <br>31.01.1970
Output for 7.3.32 - 7.3.33, 7.4.26
2013-08-01<br>2013-31-0108-01-2013 00:00:00<br/>08-31-2013 12:59:59<br/><br>1375315200<br>01.07.2013<br>01.07.2013<br>31.07.2013-----------------<br>01.01.1970<br>31.01.1970
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/3icpo on line 20
Process exited with code 255.
Output for 4.3.5 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
2013-08-01<br>2013-31-0108-01-2013 00:00:00<br/>08-31-2013 12:59:59<br/><br>1375308000<br>01.07.2013<br>01.07.2013<br>31.07.2013-----------------<br>01.01.1970<br>31.01.1970
Output for 4.3.0 - 4.3.4
2013-08-01<br>2013-31-0109-01-2013 00:00:00<br/>09-30-2013 12:59:59<br/><br>1375308000<br>01.07.2013<br>01.07.2013<br>31.07.2013-----------------<br>01.01.1970<br>31.01.1970

preferences:
213.46 ms | 402 KiB | 355 Q