You can cut it a little
<?php
if(!isset($values[$key]))
$values[$key]= 0;
$values[$key] += $total;
but the way you wrote the code is already pretty concise and, more important, a pretty clean way.
edit: the error occurs in the first place, because when writing
$values[$key] += $total;
, internally it is the same as $values[$key] = $values[$key] + $total
- and when $ value [$ key] is not triggered in the first place, it cannot be read.
PHP , 0 " " - , , .