title: PHP | How to access Key => Value pair from a Json Decoded Array
body: <p>I need to access the value of certain keys that are returned from an ebay xml request. When the xml is parsed I'm using the following code to make a Json array out of it and display it in the page.</p>
  <pre><code>$xml = simplexml_load_string($eBayResponse, &quot;SimpleXMLElement&quot;, LIBXML_NOCDATA);
  $json = json_encode($xml);
  $array = json_decode($json,TRUE);
  
  echo '&lt;pre&gt;'; print_r($array); echo '&lt;/pre&gt;';
  </code></pre>
  <p>The result looks similar to this (I wont print it all here)...</p>
  <pre><code>Array
  (
      [Timestamp] =&gt; 2022-02-07T15:56:53.324Z
      [Ack] =&gt; Success
      [Version] =&gt; 1241
      [Build] =&gt; E1241_CORE_APIXO_19220561_R1
      [PaginationResult] =&gt; Array
          (
              [TotalNumberOfPages] =&gt; 1
              [TotalNumberOfEntries] =&gt; 2
          )
  
      [HasMoreOrders] =&gt; false
      [OrderArray] =&gt; Array
          (
              [Order] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [OrderID] =&gt; 01-08113-51114
                              [OrderStatus] =&gt; Completed
                              [AdjustmentAmount] =&gt; 0.0
                              [AmountPaid] =&gt; 11.24
                              [AmountSaved] =&gt; 0.0
                              [CheckoutStatus] =&gt; Array
                                  (
                                      [eBayPaymentStatus] =&gt; NoPaymentFailure
                                      [LastModifiedTime] =&gt; 2022-02-07T01:49:06.000Z
                                      [PaymentMethod] =&gt; CreditCard
                                      [Status] =&gt; Complete
                                      [IntegratedMerchantCreditCardEnabled] =&gt; true
                                      [PaymentInstrument] =&gt; PayPal
                                  )
  
                              [ShippingDetails] =&gt; Array
                                  (
                                      [SalesTax] =&gt; Array
                                          (
                                              [SalesTaxPercent] =&gt; 0.0
                                              [SalesTaxState] =&gt; Array
                                                  (
                                                  )
  
                                              [ShippingIncludedInTax] =&gt; false
                                              [SalesTaxAmount] =&gt; 0.0
                                          )
  </code></pre>
  <p>So now I want to echo the value for the key [OrderID] in PHP. It should be really simple but I cant get the result. I tried things like...</p>
  <pre><code>echo $array['0']['OrderID'];
  </code></pre>
  <p>But don't get anything echoed out to the page. I need to grab the value of keys at each array assuming its like a directory that you need a path to?</p>
  <pre><code>echo $array['Array'][0][CheckoutStatus][PaymentMethod];
  </code></pre>
  <p>There are tons of posts about formatting and printing a readable result of an array structure but not how to obtain the value for a specific key.</p>
  <p>All tips gratefully received!</p>