3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $basket = [ [ 'name' => 'apple', 'qty' => 5, ], [ 'name' => 'apple', 'qty' => 4, ], [ 'name' => 'pear', 'qty' => 4, ] ]; $x = array_reduce($basket,function($total_qty, $e){ return $total_qty += $e['qty']; }, 0); var_dump($x);
Output for 5.6.38 - 7.2.11
int(13)