Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP SimpleXML is both an Object and an Array? Inconceivable!
    text
    copied!<p>Ok, check out this voodoo:</p> <p>This code:</p> <pre><code>$xml = new SimpleXMLElement($xml); $var = $xml-&gt;QBXMLMsgsRs-&gt;ClassQueryRs; $vars = print_r($var,true); </code></pre> <p>Returns:</p> <pre><code> SimpleXMLElement Object ( [@attributes] =&gt; Array ( [requestID] =&gt; Q2xhc3NRdWVyeXw1 [statusCode] =&gt; 0 [statusSeverity] =&gt; Info [statusMessage] =&gt; Status OK ) [ClassRet] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [ListID] =&gt; 80000002-1241128424 [TimeCreated] =&gt; 2009-04-30T17:53:44-05:00 [TimeModified] =&gt; 2009-04-30T17:53:44-05:00 [EditSequence] =&gt; 1241128424 [Name] =&gt; D1 [FullName] =&gt; D1 [IsActive] =&gt; true [Sublevel] =&gt; 0 ) [1] =&gt; SimpleXMLElement Object ( [ListID] =&gt; 80000001-1241128320 [TimeCreated] =&gt; 2009-04-30T17:52:00-05:00 [TimeModified] =&gt; 2009-04-30T17:52:00-05:00 [EditSequence] =&gt; 1241128320 [Name] =&gt; K1 [FullName] =&gt; K1 [IsActive] =&gt; true [Sublevel] =&gt; 0 ) [2] =&gt; SimpleXMLElement Object ( [ListID] =&gt; 80000003-1241128452 [TimeCreated] =&gt; 2009-04-30T17:54:12-05:00 [TimeModified] =&gt; 2009-04-30T17:54:12-05:00 [EditSequence] =&gt; 1241128452 [Name] =&gt; S1 [FullName] =&gt; S1 [IsActive] =&gt; true [Sublevel] =&gt; 0 ) ) ) </code></pre> <p>However, this code:</p> <pre><code>$xml = new SimpleXMLElement($xml); $var = $xml-&gt;QBXMLMsgsRs-&gt;ClassQueryRs-&gt;ClassRet; $vars = print_r($var,true); </code></pre> <p>Returns:</p> <pre><code>SimpleXMLElement Object ( [ListID] =&gt; 80000002-1241128424 [TimeCreated] =&gt; 2009-04-30T17:53:44-05:00 [TimeModified] =&gt; 2009-04-30T17:53:44-05:00 [EditSequence] =&gt; 1241128424 [Name] =&gt; D1 [FullName] =&gt; D1 [IsActive] =&gt; true [Sublevel] =&gt; 0 ) </code></pre> <p>For the life of me, I cannot access the rest of this object! Echo, print_r.... if I try to access the specific variable, it disappears!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload