3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr=array( Array ( 0 => 3, 1 => 1 ), Array ( 0 => 3, 1 => 2 ), Array ( 0 => 3, 1 => 128 ), Array ( 0 => 39, 1 => 4 )); $col0 = array_unique(array_column($arr, 0)); Foreach($col0 as $val){ // $res[] = [$val, Var_dump(array_sum(array_intersect_key($arr, array_intersect($col0, [$val])))); } Var_dump($res);
based on bVC7v
Output for 5.6.30, hhvm-3.18.5 - 3.21.3, 7.0.30 - 7.3.0alpha1
int(0) int(0) Notice: Undefined variable: res in /in/OAJfJ on line 31 NULL
Output for hhvm-3.22.0
int(0) int(0) Notice: Undefined variable: res in /in/OAJfJ on line -1 NULL