I have this array

**$g=("RathiB36E8310"=>"10","JindalB36E8320"=>"20","RathiB36E8310"=>"5")**

If same combination of `$pr_vendor$brand$category` exists then i add the `$cart_item['quantity']` to it and hence it gets updated.
But my last entry is not getting updated and duplicate values exist inspite of not in array condition.What is that i am doing wrong 

```
 $g = array("$pr_vendor$brand$category" => $cart_item['quantity']);
        $keyExists;
        foreach ($wer as $key => $value) {
            if ($key == "$pr_vendor$brand$category") {
                $wer["$pr_vendor$brand$category"]+=$cart_item['quantity'];
                $keyExists = "true";
            }
        }
        if (!$keyExists == "true") {
            $wer[] = $g;
    }

```

**OUTPUT (Expected)**

$wer=array("RathiB36E8310"=>"15","JindalB36E8320"=>"20")