note 100811 added to class.simplexmlelement
| From: | rmirabelle at osu1 dot php dot net | Date: | Mon, 08 Nov 2010 17:42:05 +0000 |
| Subject: | note 100811 added to class.simplexmlelement | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173861@lists.php.net to get a copy of this message | ||
To further previous comments and drive the point home:
What makes SimpleXMLElement tricky to work with is that it feels and behaves like an object, but is
actually a system RESOURCE, (specifically a libxml resource).
That's why you can't store a SimpleXMLElement to $_SESSION or perform straight comparison
operations on node values without first casting them to some type of object. $_SESSION expects to
store 'an object' and comparison operators expect to compare 2 'objects' and
SimpleXMLElements are not objects.
When you echo or print a node's value, PHP converts the value (a resource) into a string object
for you. It's a time saver for sure, but can fool you into thinking that your SimpleXMLElement
is an object.
Hope this helps clarify
----
Server IP: 69.147.83.197
Probable Submitter: 98.254.60.60
----
Manual Page -- http://www.php.net/manual/en/class.simplexmlelement.php
Edit -- https://master.php.net/note/edit/100811
Del: integrated -- https://master.php.net/note/delete/100811/integrated
Del: useless -- https://master.php.net/note/delete/100811/useless
Del: bad code -- https://master.php.net/note/delete/100811/bad+code
Del: spam -- https://master.php.net/note/delete/100811/spam
Del: non-english -- https://master.php.net/note/delete/100811/non-english
Del: in docs -- https://master.php.net/note/delete/100811/in+docs
Del: other reasons-- https://master.php.net/note/delete/100811
Reject -- https://master.php.net/note/reject/100811
Search -- https://master.php.net/manage/user-notes.php