I have an array
$hourly = array(
"01" => "0",
"02" => "0",
"03" => "0",
"04" => "0",
"05" => "0",
"06" => "0",
"07" => "0",
"08" => "0",
"09" => "0",
"10" => "0",
"11" => "0",
"12" => "0",
"13" => "0",
"14" => "0",
"15" => "0",
"16" => "0",
"17" => "0",
"18" => "0",
"19" => "0",
"20" => "0",
"21" => "0",
"22" => "0",
"23" => "0"
);
And I have a bunch of data like "01" and "03" and "21" and I want to add (+1) to that specific value in the array. So with the data set "01","03","21","01","22" the resulting array would be
$hourly = array(
"01" => "2",
"02" => "0",
"03" => "1",
"04" => "0",
"05" => "0",
"06" => "0",
"07" => "0",
"08" => "0",
"09" => "0",
"10" => "0",
"11" => "0",
"12" => "0",
"13" => "0",
"14" => "0",
"15" => "0",
"16" => "0",
"17" => "0",
"18" => "0",
"19" => "0",
"20" => "0",
"21" => "1",
"22" => "1",
"23" => "0"
);
How could I go about doing that? Is there a function to add 1 to an array element?