Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a SimpleXMLElement?

Tags:

php

simplexml

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]?

like image 572
Michael Avatar asked Sep 28 '26 10:09

Michael


1 Answers

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.

like image 74
Francis Avila Avatar answered Sep 29 '26 23:09

Francis Avila



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!