Good Day,
im just confused as to why my data structure doesnt render array, its displays list of objects instead, the code below aims to store days of months on array structure,
$calendar = [];
for ($m=1; $m<=12; $m++) {
$s=date ("w", mktime (0,0,0,$month,1,$year));
for ($ds=1;$ds<=$s;$ds++) {
$row_day = new stdClass();
$row_day->day = $d;
$row_day->is_holiday = $is_holiday;
$row_day->is_paydate = $is_paydate;
//day of the week
$row_day->dotw = date("w",mktime (0,0,0,$month,$d,$year));
$row_day->is_funds_due = $is_funds_due;
$calendar[$m][] = $row_day;
}
}
echo json_encode(array('type'=>2,'data'=>$calendar));
but when I console.log on my js it produces this structure.. which clearly is not an array..
am I wrong on building my structure?
its just that its easier to manipulate if its on array mode. since you can just use data.length, but in my case it doesnt work..
thanks for reading, Have a good Day!