3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $result5 = array( array('start_date' => '2005-10-12', 'name_event' => 'test1'), array('start_date' => '2006-10-12', 'name_event' => 'test2'), ); 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/>'; $result = addDailyHtml( "Event", "$day-$month-$year");// there is some problem var_dump($result); } function addDailyHtml( $html, $start_date_string, $end_date_string = null ) { 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++; return $daily_html; }
Output for 5.1.3 - 7.1.0
12 10 2005 test1<br/>array(1) { [2005]=> array(1) { [10]=> array(1) { [12]=> array(1) { [0]=> string(5) "Event" } } } } 12 10 2006 test2<br/>array(1) { [2006]=> array(1) { [10]=> array(1) { [12]=> array(1) { [1]=> string(5) "Event" } } } }
Output for 5.1.0 - 5.1.2
12 10 2005 test1<br/>array(1) { [1970]=> array(1) { [1]=> array(1) { [1]=> array(1) { [0]=> string(5) "Event" } } } } 12 10 2006 test2<br/>array(1) { [1970]=> array(1) { [1]=> array(1) { [1]=> array(1) { [1]=> string(5) "Event" } } } }
Output for 4.3.0 - 5.0.5
12 10 2005 test1<br/>array(1) { [2018]=> array(1) { [3]=> array(1) { [28]=> array(1) { [0]=> string(5) "Event" } } } } 12 10 2006 test2<br/>array(1) { [2018]=> array(1) { [3]=> array(1) { [29]=> array(1) { [1]=> string(5) "Event" } } } }