function processArray($data) {
foreach($data as $key => $value)
if( $value['active'] )
return [$key];
elseif( !empty($value['children']) && $res = processArray($value['children'], $key))
return array_merge([$key],$res);
return null;
}