3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* $belongGroup = [ 2, 1 ]; $groups = [ 1 => ['parent_group_id' => 0, 'group_id' => 1], 2 => ['parent_group_id' => 1, 'group_id' => 2], 3 => ['parent_group_id' => 0, 'group_id' => 3], 4 => ['parent_group_id' => 0, 'group_id' => 4], ]; $result = []; foreach($belongGroup as $g) { $l = $groups[$g]; while(true) { if ($l['parent_group_id'] == 0) { break; } $parentId = $l['parent_group_id']; $l = $groups[$parentId]; unset($groups[$parentId]); } $result[] = intval($l['group_id']); } echo implode(", ", $result);*/ $g = []; $l = $g[5]; echo $l['yolo'] == 0;
based on 3nUVo
Output for 5.5.0 - 7.3.0beta1
Notice: Undefined offset: 5 in /in/upegc on line 31 1