public static function getByIndex(Int $get = 1, Int $index = 1) : String
    {
        $segArr = self::segmentArray();

        if( $get == 0 )
        {
            $get = 1;
        }

        $get -= 1;
        $uri  = '';

        $countSegArr = count($segArr);

        if( $index < 0 )
        {
            $index = $countSegArr + $index + 1;
        }

        if( $index > 0 )
        {
            $index = $get + $index;
        }

        if( abs($index) > $countSegArr )
        {
            $index = $countSegArr;
        }

        for( $i = $get; $i < $index; $i++ )
        {
            $uri .= $segArr[$i].'/';
        }

        return rtrim($uri, '/');
    }
public static function getByIndex(Int $get = 1, Int $index = 1) : String
    {
        $segArr = self::segmentArray();

        if( $get == 0 )
        {
            $get = 1;
        }

        $get -= 1;
        $uri  = '';

        $countSegArr = count($segArr);

        if( $index < 0 )
        {
            $index = $countSegArr + $index + 1;
        }

        if( $index > 0 )
        {
            $index = $get + $index;
        }

        if( abs($index) > $countSegArr )
        {
            $index = $countSegArr;
        }

        for( $i = $get; $i < $index; $i++ )
        {
            $uri .= $segArr[$i].'/';
        }

        return rtrim($uri, '/');
    }
public static function getByIndex ( Int $ get = 1 , Int $ index = 1 ) : String { $ segArr = self :: segmentArray ( ) ; if ( $ get == 0 ) { $ get = 1 ; } $ get -= 1 ; $ uri = '' ; $ countSegArr = count ( $ segArr ) ; if ( $ index < 0 ) { $ index = $ countSegArr + $ index + 1 ; } if ( $ index > 0 ) { $ index = $ get + $ index ; } if ( abs ( $ index ) > $ countSegArr ) { $ index = $ countSegArr ; } for ( $ i = $ get ; $ i < $ index ; $ i ++ ) { $ uri .= $ segArr [ $ i ] . '/' ; } return rtrim ( $ uri , '/' ) ; }
Used to get the range according to the index of the specified segment.

@param int $get   = 1
@param int $index = 1

@return string
Used to get the range according to the index of the specified segment .