PHP Sum function with callback function
I get some data structure from database: 

    object {
      currency,
      rate,
      amount
    }

I want find some function like: $data.sum($a => $a.amount) for return sum of amount. But I can't find it. So a have write this:

    array_sum(array_map(function($obj) {
      return $obj->amount;
    }, $transferList));

Is any easiest way?
PHP Sum function with callback function
===

I get some data structure from database: 

    object {
      currency,
      rate,
      amount
    }

I want find some function like: $data.sum($a => $a.amount) for return sum of amount. But I can't find it. So a have write this:

    array_sum(array_map(function($obj) {
      return $obj->amount;
    }, $transferList));

Is any easiest way?