3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result5 = array( array('start_date' => '2005-10-12', 'name_event' => 'test1'), array('start_date' => '2006-10-12', 'name_event' => 'test2'), ); $daily_html = ''; foreach($result5 as $row5) { $time=strtotime($row5['start_date']); $day = date("d",$time); $month= date("m",$time); $month2= date("F",$time); $year=date("Y",$time); echo "$day $month $year ".$row5['name_event'] ; // this show me correct echo '<br/>'; addDailyHtml( "Event", "$day-$month-$year", $daily_html);// there is some problem } var_dump($daily_html); function addDailyHtml( $html, $start_date_string, $end_date_string = null, &$daily_html ) { static $htmlCount = 0; $start_date = strtotime($start_date_string); if( $end_date_string ) { $end_date = strtotime($end_date_string); } else { $end_date = $start_date; } $working_date = $start_date; do { $tDate = getdate($working_date); $working_date += 86400; $daily_html[$tDate['year']][$tDate['mon']][$tDate['mday']][$htmlCount] = $html; } while( $working_date < $end_date + 1 ); $htmlCount++; }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Deprecated: Optional parameter $end_date_string declared before required parameter $daily_html is implicitly treated as a required parameter in /in/pEAC3 on line 25 12 10 2005 test1<br/> Fatal error: Uncaught ArgumentCountError: Too few arguments to function addDailyHtml(), 3 passed in /in/pEAC3 on line 21 and exactly 4 expected in /in/pEAC3:25 Stack trace: #0 /in/pEAC3(21): addDailyHtml('Event', '12-10-2005', '') #1 {main} thrown in /in/pEAC3 on line 25
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $daily_html follows optional parameter $end_date_string in /in/pEAC3 on line 25 12 10 2005 test1<br/> Fatal error: Uncaught ArgumentCountError: Too few arguments to function addDailyHtml(), 3 passed in /in/pEAC3 on line 21 and exactly 4 expected in /in/pEAC3:25 Stack trace: #0 /in/pEAC3(21): addDailyHtml('Event', '12-10-2005', '') #1 {main} thrown in /in/pEAC3 on line 25
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
12 10 2005 test1<br/> Fatal error: Uncaught ArgumentCountError: Too few arguments to function addDailyHtml(), 3 passed in /in/pEAC3 on line 21 and exactly 4 expected in /in/pEAC3:25 Stack trace: #0 /in/pEAC3(21): addDailyHtml('Event', '12-10-2005', '') #1 {main} thrown in /in/pEAC3 on line 25
Process exited with code 255.
Output for 5.1.0 - 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.40, 7.0.0 - 7.0.33
12 10 2005 test1<br/> Warning: Missing argument 4 for addDailyHtml(), called in /in/pEAC3 on line 21 and defined in /in/pEAC3 on line 25 12 10 2006 test2<br/> Warning: Missing argument 4 for addDailyHtml(), called in /in/pEAC3 on line 21 and defined in /in/pEAC3 on line 25 string(0) ""
Output for 5.0.0 - 5.0.5
12 10 2005 test1<br/> Warning: Missing argument 4 for addDailyHtml() in /in/pEAC3 on line 25 12 10 2006 test2<br/> Warning: Missing argument 4 for addDailyHtml() in /in/pEAC3 on line 25 string(0) ""
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
12 10 2005 test1<br/> Warning: Missing argument 4 for adddailyhtml() in /in/pEAC3 on line 25 12 10 2006 test2<br/> Warning: Missing argument 4 for adddailyhtml() in /in/pEAC3 on line 25 string(0) ""

preferences:
286.55 ms | 402 KiB | 461 Q