public static function array_find_available_index($array, $seed = null)
    {
        if (!is_null($seed)) {
            $index = $seed;
        } else {
            $keys = array_keys($array);
            sort($keys);
            $index = array_pop($keys);
        }

        if (isset($array[$index])) {
            do {
                $index++;
            } while (isset($array[$index]));
        }

        return $index;
    }
public static function array_find_available_index($array, $seed = null)
    {
        if (!is_null($seed)) {
            $index = $seed;
        } else {
            $keys = array_keys($array);
            sort($keys);
            $index = array_pop($keys);
        }

        if (isset($array[$index])) {
            do {
                $index++;
            } while (isset($array[$index]));
        }

        return $index;
    }
public static function array_find_available_index ( $ array , $ seed = null ) { if ( ! is_null ( $ seed ) ) { $ index = $ seed ; } else { $ keys = array_keys ( $ array ) ; sort ( $ keys ) ; $ index = array_pop ( $ keys ) ; } if ( isset ( $ array [ $ index ] ) ) { do { $ index ++ ; } while ( isset ( $ array [ $ index ] ) ) ; } return $ index ; }
Find the next available index in an array. Works best with numeric keys.
The next available index is the minimum integer such that the array does
not have a mapping for that index. Uses the increment operator on the
index type of the input array, whatever that may do.

@param array $array
the array to find the next index for.
@param mixed $seed (optional)
the object with which the search for an empty index is initialized. this
defaults to null.
@return integer
the minimum empty index into the input array.
Find the next available index in an array . Works best with numeric keys . The next available index is the minimum integer such that the array does not have a mapping for that index . Uses the increment operator on the index type of the input array whatever that may do .