I am having a problem with this code:
$days = array();
$d = new StdClass;
for($i = 0; $i < 7; $i++){
$day = date("Y-m-d", strtotime("-".$i." day"));
$d->x = $day; //error
$days[] = $d;
unset($d);
}
dd($days);
Even thought I have declared a new object it shows me error:
Creating default object from empty value.
How could i possibly resolve this problem?