Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i add an index [0] to and object
    text
    copied!<p>I have the following object(below):</p> <pre><code>object(stdClass)#49 (1) { ["NewOrder"] =&gt; object(stdClass)#50 (12) { ["BTN"] =&gt; string(10) "XXXXXXXXXXXXXXXxx" ["PreOrderTransactionId"] =&gt; string(22) "XXXXXXXX" ["PartnerOrderId"] =&gt; string(17) "XXXXXXXXXXX" ["QwestOrderId"] =&gt; string(9) "N57395699" ["SalesCode"] =&gt; string(7) "XXXXXXXX" ["OrderStatus"] =&gt; string(7) "Pending" ["OrderStatusCode"] =&gt; string(4) "OPEN" ["OrderStatusSourceSystem"] =&gt; string(5) "CPLUS" ["OrderStatusMessage"] =&gt; string(0) "" ["OrderStatusDate"] =&gt; string(10) "2013-12-09" ["OrderStatusTime"] =&gt; string(8) "08:02:30" ["ProductFamily"] =&gt; array(3) { [0] =&gt; object(stdClass)#51 (2) { ["ProductFamilyName"] =&gt; string(7) "BUNDLE+" ["ProductLines"] =&gt; object(stdClass)#52 (3) { ["WTN"] =&gt; string(10) "3033689919" ["AppointmentDate"] =&gt; string(10) "2013-12-20" ["Products"] =&gt; object(stdClass)#53 (5) { ["ProductName"] =&gt; string(36) "INTERNET 100+ MBPS &amp; HOME PHONE PLUS" ["Usoc"] =&gt; string(5) "BBBVC" ["Quantity"] =&gt; string(1) "1" ["Action"] =&gt; string(1) "I" ["Status"] =&gt; string(4) "OPEN" } } } } } } </code></pre> <p>How can add an index[0] after ["NewOrder"] object to look like this:</p> <pre><code>object(stdClass)#49 (1) { ["NewOrder"] =&gt; array(1) { [0] =&gt; object(stdClass)#50 (12) { </code></pre> <p>the reason i need to do this is because sometimes the it will only have one Order sometime it will have multiples.If the there is only one it will fail in the for each loop.</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