I have this array
$date = array{"2013-09-17 00:21:00",
"2013-09-23 00:12:00",
"2013-09-23 00:41:00",
"2013-09-20 00:13:00",
"2013-09-19 00:34:00",
"2013-09-17 00:38:00"}
I'm trying to sum the time inside the array that have the same date.
This is my expected output:
$date = array{"2013-09-17 00:59:00",
"2013-09-23 00:53:00",
"2013-09-20 00:13:00",
"2013-09-19 00:34:00"}
Now this is what I have tried so far
foreach($date as $key => $value)
{
$lf_date[] = date("Y-m-d",strtotime($value));
$lf_time[] = date("H:i:s",strtotime($value));
if(isset($lf_date[$key]))
{
$output[] += $lf_time[$key];
}
else
{
$output[] = $lf_time[$key];
}
}
This gives me a 0 output T_T.. I already tried searching on google and it says that I have to use isset and array_key_exists but I can't get it to work. :(. Thanks for anyone who could help me.