public static function array_insert(&$array, $item, $position) {
        if ($position == 0) {
            /* Prepend the item */
            array_unshift($array, $item);
        } else {
            if (count($array) == $position) {
                $array[] = $item;
            } else {
                array_splice($array, $position, 0, array($item));
            }
        }
    }