I got the following array from my code.
foreach($JobworkMaterialJson as $key => $value) {
$decode = json_decode($value->jobcard_jobwork_json);
}
by the print_r($decode), I got following result now I want to sum values which id is same. e.g. id=6 qty would be 25. help will be highly appreciated. Thanks
<pre>Array(
[0] => stdClass Object
(
[id] => 9
[qty] => 5
)
)
</pre><pre>Array
(
[0] => stdClass Object
(
[id] => 6
[qty] => 10
)
[1] => stdClass Object
(
[id] => 7
[qty] => 5
)
)
</pre><pre>Array
(
[0] => stdClass Object
(
[id] => 6
[qty] => 15
)
)
</pre>