I have the following code:
$chart_data = array();
foreach ($range as $range_day) {
foreach ($numbers as $number) {
if($range_day == $number['date']){
@$chart_data[$range_day] += $number['events'];
} else {
if(isset($chart_data[$range_day])){
$chart_data[$range_day] += 0;
}
}
}
}
This line: $chart_data[$range_day] += 0; was giving me an undefined index error, so I added the isset check, but it's not set so it wrecks my array. I know that it's not set, and I don't care, but I read all over that the @ solution is in poor taste. How can I remove the error the correct way?