/** * Get sibling node * @param int $offset Offset from current node * @return DomNode Null if not found */ function getSibling($offset = 1) { $index = $this->index() + $offset; if ($index >= 0 && $index < $this->parent->childCount()) { return $this->parent->getChild($index); } else { return null; } }