I have an array of objects, and i want to sum value of one of the properties, example:
Array ( [0] => stdClass Object ( [name] => jon
array_reduce could be one way to do it; Just simply add your $array
array_reduce
$array
$sum = array_reduce($array, function($carry, $item) { return $carry + $item->commission; }); var_dump($sum);