public static function moveArrayKeyToPos($key, $pos, $arr): array
    {
        if (!isset($arr[$key])) {
            return $arr;
        }

        $tempValue = $arr[$key];
        unset($arr[$key]);

        if ($pos === 0) {
            return [$key => $tempValue] + $arr;
        }

        if ($pos > \count($arr)) {
            return $arr + [$key => $tempValue];
        }

        $new_arr = [];
        $i = 1;

        foreach ($arr as $arr_key => $arr_value) {
            if ($i === $pos) {
                $new_arr[$key] = $tempValue;
            }

            $new_arr[$arr_key] = $arr_value;
            ++$i;
        }

        return $new_arr;
    }