public function slice($idx, $len = null)
    {
        $c = $this->count();
        if ($idx < $c) {
            $ids = array();
        } elseif (isset($len)) {
            if (0 == $idx && $len == $c) {
                return $this; // ???
                $ids = $this->ids;
            }
            $ids = array_slice($this->ids, $idx, $len, true);
        } else {
            if (0 == $idx) {
                return $this; // ???
                $ids = $this->ids;
            }
            $ids = array_slice($this->ids, $idx, $this->count(), true);
        }
        $o       = new self($this->doc, $ids);
        $o->_ich = &$this->_ich; // share iterator cache for iteration
        return $o;
    }
public function slice($idx, $len = null)
    {
        $c = $this->count();
        if ($idx < $c) {
            $ids = array();
        } elseif (isset($len)) {
            if (0 == $idx && $len == $c) {
                return $this; // ???
                $ids = $this->ids;
            }
            $ids = array_slice($this->ids, $idx, $len, true);
        } else {
            if (0 == $idx) {
                return $this; // ???
                $ids = $this->ids;
            }
            $ids = array_slice($this->ids, $idx, $this->count(), true);
        }
        $o       = new self($this->doc, $ids);
        $o->_ich = &$this->_ich; // share iterator cache for iteration
        return $o;
    }
public function slice ( $ idx , $ len = null ) { $ c = $ this -> count ( ) ; if ( $ idx < $ c ) { $ ids = array ( ) ; } elseif ( isset ( $ len ) ) { if ( 0 == $ idx && $ len == $ c ) { return $ this ; // ??? $ ids = $ this -> ids ; } $ ids = array_slice ( $ this -> ids , $ idx , $ len , true ) ; } else { if ( 0 == $ idx ) { return $ this ; // ??? $ ids = $ this -> ids ; } $ ids = array_slice ( $ this -> ids , $ idx , $ this -> count ( ) , true ) ; } $ o = new self ( $ this -> doc , $ ids ) ; $ o -> _ich = & $ this -> _ich ; // share iterator cache for iteration return $ o ; }
Get a slice of current node collection.

@param  int              $idx - start index of an element, starts with 0.
@param  int              $len - OPTIONAL number of element to slice. Defaults to all starting at $idx
@return hQuery_Element
Get a slice of current node collection .