I have seen various posted about this question so am aware some answers to this may exist. however I am none the wiser after reading these.
I have an array that is
You could use array_map first to collect the vatAmout value.
array_map
vatAmout
$sum = array_sum(array_map(function($var) { return $var['vatAmout']; }, $account_invoices));