i will make it. i hope it will helpful for you: you can get your required out put by using an extra array, first of all, count your array elements, this will you condition. this simple check
$Array1[$x] == $Array1[$x+1]
will check if the array consecutive address have same value. (the condition is array must be sorted),
and the other value like this:
$arr[$Array1[$x]] // assign a key
this is for making it associate array :
$Array1 = ["bus","bus","int"];
$Array2 = [2,18,10];
$arr = [];
for ($x = 0; $x < count($Array1); $x++) {
if($Array1[$x] == $Array1[$x+1])
{
$arr[$Array1[$x]] = $Array2[$x] + $Array2[$x+1];
$x++;
}
else
{
$arr[$Array1[$x]] = $Array2[$x];
}
}
the output is:
Array ( [bus] => 20 [int] => 10 )