src/SimpleDOM.php
public function insertBeforeSelf(SimpleXMLElement $new)
    {
        $tmp = dom_import_simplexml($this);
        $node = $tmp->ownerDocument->importNode(dom_import_simplexml($new), true);

        return simplexml_import_dom($this->insertNode($tmp, $node, 'before'), get_class($this));
    }
public function insertBeforeSelf(SimpleXMLElement $new)
    {
        $tmp = dom_import_simplexml($this);
        $node = $tmp->ownerDocument->importNode(dom_import_simplexml($new), true);

        return simplexml_import_dom($this->insertNode($tmp, $node, 'before'), get_class($this));
    }
public function insertBeforeSelf ( SimpleXMLElement $ new ) { $ tmp = dom_import_simplexml ( $ this ) ; $ node = $ tmp -> ownerDocument -> importNode ( dom_import_simplexml ( $ new ) , true ) ; return simplexml_import_dom ( $ this -> insertNode ( $ tmp , $ node , 'before' ) , get_class ( $ this ) ) ; }
Add a new sibling before this node

This is a convenience method. The same result can be achieved with
<code>
$node->parentNode()->insertBefore($new, $node);
</code>

@param    SimpleXMLElement $new New node
@return    SimpleDOM                    The inserted node
Add a new sibling before this node