public static function flatten(array $arr)
    {
        $flat = [];
        foreach ($arr as $v) {
            if (is_array($v)) {
                $flat = array_merge($flat, self::flatten($v));
            } else {
                $flat[] = $v;
            }
        }
        return $flat;
    }