Remove SimpleXMLElement?

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

The problem is, I can't figure out how it goes.

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

?

+3


source to share


2 answers


SimpleXMLElement

represents a massive interface on its child nodes using magic methods. This is due to custom __unset

behavior that causes SimpleXMLElement to act as a "member" (child) of its "array" (set of children) removed.



+1


source


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

you will see:



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

        )

)

      

0


source







All Articles