public function deleteNode($node)
    {
        $target_pos = $node->getPosition();
        $this->rewind();
        $pos = 0;

        // Omit target node and adjust pos of remainder
        $done = false;
        try {
            while ($n = $this->current()) {
                if ($pos == $target_pos && !$done) {
                    $done = true;
                    $this->next();
                    $this->offsetUnset($pos);
                } elseif ($pos >= $target_pos) {
                    $n->setPosition($pos);
                    $pos++;
                    $this->next();
                } else {
                    $pos++;
                    $this->next();
                }
            }
        }
        catch (Exception $e) {
            // no-op - shift() throws an exception, sigh
        }

    }
public function deleteNode($node)
    {
        $target_pos = $node->getPosition();
        $this->rewind();
        $pos = 0;

        // Omit target node and adjust pos of remainder
        $done = false;
        try {
            while ($n = $this->current()) {
                if ($pos == $target_pos && !$done) {
                    $done = true;
                    $this->next();
                    $this->offsetUnset($pos);
                } elseif ($pos >= $target_pos) {
                    $n->setPosition($pos);
                    $pos++;
                    $this->next();
                } else {
                    $pos++;
                    $this->next();
                }
            }
        }
        catch (Exception $e) {
            // no-op - shift() throws an exception, sigh
        }

    }
public function deleteNode ( $ node ) { $ target_pos = $ node -> getPosition ( ) ; $ this -> rewind ( ) ; $ pos = 0 ; // Omit target node and adjust pos of remainder $ done = false ; try { while ( $ n = $ this -> current ( ) ) { if ( $ pos == $ target_pos && ! $ done ) { $ done = true ; $ this -> next ( ) ; $ this -> offsetUnset ( $ pos ) ; } elseif ( $ pos >= $ target_pos ) { $ n -> setPosition ( $ pos ) ; $ pos ++ ; $ this -> next ( ) ; } else { $ pos ++ ; $ this -> next ( ) ; } } } catch ( Exception $ e ) { // no-op - shift() throws an exception, sigh } }
Deletes a node from the linked list.

@param mixed $node Node to delete from the list

@return void
Deletes a node from the linked list .