array(2)
{
["datetime"]=> array(2)
{
[0]=> string(10) "19.07.2019"
[1]=> string(10) "19.07.2019"
[2]=> string(10) "20.07.2019"
}
["quantity"]=> array(2)
{
[0]=> string(1) "3"
[1]=> string(1) "1"
[2]=> string(1) "5"
}
}
array(2)
{
["datetime"]=> array(2)
{
[0]=> string(10) "19.07.2019"
[1]=> string(10) "20.07.2019"
}
["quantity"]=> array(2)
{
[0]=> string(1) "4"
[1]=> string(1) "5"
}
}
$data = [];
$data["datetime"] = [
"19.07.2019",
"19.07.2019",
"20.07.2019",
];
$data["quantity"] = [
"3",
"1",
"5"
];
$resultArray = [];
foreach($data["datetime"] as $key => $value) {
if(array_key_exists($data["datetime"][$key], $resultArray)) {
$resultArray[$data["datetime"][$key]] = $resultArray[$data["datetime"][$key]] + $data["quantity"][$key];
} else {
$resultArray[$data["datetime"][$key]] = $data["quantity"][$key];
}
}
print_r($resultArray);