title: PHP array_key_exists condition not printing after statement
body: <p>I am calling an external api endpoint and it returns an XML. I am trying to catch if the the translated json from the xml has a current array key since it does not have an <code>status</code> column so I manually trying to do some condition.</p>
  <p>Here is what I tried</p>
  <p>My code in transforming xml to json and printing the response</p>
  <pre><code>            $parsed_xml = json_encode(simplexml_load_string($response));
              $finalJson = json_decode($parsed_xml,true);
              dd($finalJson);
              if(isset($finalJson['ErrorResponse'])){
                 dd('Error response');
              }else{
                 dd($finalJson['GetTransportContentResult']['TransportContent']['TransportHeader']['IsPartnered']);
              }
  </code></pre>
  <p>When I run <code>php artisan tinker</code> and call the controller method (without the conditions for checking the response, i used <code>dd($finalJson)</code>, here are the outputs</p>
  <p>If the response has error, the translated xml becomes like this</p>
  <pre><code>array:2 [
    &quot;Error&quot; =&gt; array:3 [
      &quot;Type&quot; =&gt; &quot;Sender&quot;
      &quot;Code&quot; =&gt; &quot;AccessDenied&quot;
      &quot;Message&quot; =&gt; &quot;AuthToken is not valid for SellerId and AWSAccountId.&quot;
    ]
    &quot;RequestID&quot; =&gt; &quot;be9742cd-516b-43f7-9a9e-bee00ad07b4f&quot;
  ]
  </code></pre>
  <p>But if it  is successful the response is</p>
  <pre><code>array:2 [
    &quot;GetTransportContentResult&quot; =&gt; array:1 [
      &quot;TransportContent&quot; =&gt; array:3 [
        &quot;TransportHeader&quot; =&gt; array:4 [
          &quot;SellerId&quot; =&gt; &quot;AZZQLCSVQ753J&quot;
          &quot;ShipmentId&quot; =&gt; &quot;FBA15XJRFN14&quot;
          &quot;IsPartnered&quot; =&gt; &quot;true&quot;
          &quot;ShipmentType&quot; =&gt; &quot;LTL&quot;
        ]
  </code></pre>
  <p>I dont know if I add the if-else code i wrote, it returns <code>true</code> in tinker and it does not go to print the <code>dd('Error response')</code> I also tried using <code>array_key_exists('Error',$finalJson)</code> but it does the same thing. Can someone tell me if I am doing the correct thing or I missed something. Thanks a lot.</p>
  <p>EDIT: @RigsFolly want me to show the raw result of <code>$response</code>, I just used <code>dd($response)</code> and run the method in tinker and these are the results</p>
  <p>If the response is success</p>
  <pre><code>&lt;GetTransportContentResponse xmlns=&quot;http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/&quot;&gt;\n
    &lt;GetTransportContentResult&gt;\n
      &lt;TransportContent&gt;\n
        &lt;TransportHeader&gt;\n
          &lt;SellerId&gt;AZZQLCSVQ753J&lt;/SellerId&gt;\n
          &lt;ShipmentId&gt;FBA15XJRFN14&lt;/ShipmentId&gt;\n
          &lt;IsPartnered&gt;true&lt;/IsPartnered&gt;\n
          &lt;ShipmentType&gt;LTL&lt;/ShipmentType&gt;\n
        &lt;/TransportHeader&gt;\n
        &lt;TransportDetails&gt;\n
          &lt;PartneredLtlData&gt;\n
            &lt;IsBillOfLadingAvailable&gt;true&lt;/IsBillOfLadingAvailable&gt;\n
            &lt;FreightReadyDate&gt;Tue Jan 12 00:00:00 GMT 2021&lt;/FreightReadyDate&gt;\n
            &lt;AmazonReferenceId&gt;12113840411&lt;/AmazonReferenceId&gt;\n
            &lt;PreviewPickupDate&gt;Wed Jan 13 00:00:00 GMT 2021&lt;/PreviewPickupDate&gt;\n
            &lt;PreviewFreightClass&gt;175.0&lt;/PreviewFreightClass&gt;\n
            &lt;PartneredEstimate&gt;\n
              &lt;Amount&gt;\n
                &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;\n
                &lt;Value&gt;229.95&lt;/Value&gt;\n
              &lt;/Amount&gt;\n
              &lt;VoidDeadline&gt;2021-01-12T17:34:56Z&lt;/VoidDeadline&gt;\n
            &lt;/PartneredEstimate&gt;\n
            &lt;SellerDeclaredValue&gt;\n
              &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;\n
              &lt;Value&gt;1006.40&lt;/Value&gt;\n
            &lt;/SellerDeclaredValue&gt;\n
            &lt;PalletList&gt;\n
              &lt;member&gt;\n
                &lt;IsStacked&gt;false&lt;/IsStacked&gt;\n
                &lt;Weight&gt;\n
                  &lt;Unit&gt;pounds&lt;/Unit&gt;\n
                  &lt;Value&gt;344.0&lt;/Value&gt;\n
                &lt;/Weight&gt;\n
                &lt;Dimensions&gt;\n
                  &lt;Unit&gt;IN&lt;/Unit&gt;\n
                  &lt;Width&gt;40.0&lt;/Width&gt;\n
                  &lt;Length&gt;48.0&lt;/Length&gt;\n
                  &lt;Height&gt;45.0&lt;/Height&gt;\n
                &lt;/Dimensions&gt;\n
              &lt;/member&gt;\n
            &lt;/PalletList&gt;\n
            &lt;BoxCount&gt;34&lt;/BoxCount&gt;\n
            &lt;Contact&gt;\n
              &lt;Phone&gt;(510) 970-9910&lt;/Phone&gt;\n
              &lt;Name&gt;Mario&lt;/Name&gt;\n
              &lt;Email&gt;Orders@orionlog.com&lt;/Email&gt;\n
            &lt;/Contact&gt;\n
            &lt;TotalWeight&gt;\n
              &lt;Unit&gt;pounds&lt;/Unit&gt;\n
              &lt;Value&gt;344.0&lt;/Value&gt;\n
            &lt;/TotalWeight&gt;\n
          &lt;/PartneredLtlData&gt;\n
        &lt;/TransportDetails&gt;\n
        &lt;TransportResult&gt;\n
          &lt;TransportStatus&gt;CONFIRMED&lt;/TransportStatus&gt;\n
        &lt;/TransportResult&gt;\n
      &lt;/TransportContent&gt;\n
    &lt;/GetTransportContentResult&gt;\n
    &lt;ResponseMetadata&gt;\n
      &lt;RequestId&gt;313995bb-b198-469d-9c95-af4feb1a0745&lt;/RequestId&gt;\n
    &lt;/ResponseMetadata&gt;\n
  &lt;/GetTransportContentResponse&gt;\n
  </code></pre>
  <p>If it has an error</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;\n
  &lt;ErrorResponse xmlns=&quot;http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/&quot;&gt;\n
    &lt;Error&gt;\n
      &lt;Type&gt;Sender&lt;/Type&gt;\n
      &lt;Code&gt;AccessDenied&lt;/Code&gt;\n
      &lt;Message&gt;AuthToken is not valid for SellerId and AWSAccountId.&lt;/Message&gt;\n
    &lt;/Error&gt;\n
    &lt;RequestID&gt;b0df9b31-fe36-4936-883e-1c8b19157ba9&lt;/RequestID&gt;\n
  &lt;/ErrorResponse&gt;\n
  </code></pre>