删除SimpleXMLElement?

I found (here) an answer regarding the way to delete a node of a SimpleXMLElement object.

The problem is I can not really understand how is that happening.

I mean, that $image var is a ref, right? So, what and where it is that $image[0][0]?

SimpleXMLElement presents an array-like interface on its child nodes via magic methods. This behavior is because of custom __unset behavior that causes the SimpleXMLElement to act as though a "member" (child element) of its "array" (set of child elements) has been removed.

If you put a print_r($image) right after the $image = $galleries->xpath(...

you'll see:

Array
(
    [0] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [name] => Hansio
                )

        )

)