title: Json decode in PHP and how to read the key value
body: <p>I have a json <code>$result = json_decode($result);</code> PHP
  JSON EX:</p>
  
  <pre><code>  [
    {
        "X": "Teste1 X",
        "Y": "Teste1 Y",
        "Z": "Teste1 Z",
        "A": {
            "C": "Teste1 C"
        },
        "B": {
            "D": "Teste1 D"
        }
    }
    ]
  </code></pre>
  
  <p>How to read the key value "A" and "B"?</p>
  
  <p>Key value "C" e "D" in "A" e "B"?</p>
  
  <pre><code>$result = json_decode($result);
  
  foreach ($result as $key =&gt; $value) {
      $strx    = $value-&gt;X;
      $stry    = $value-&gt;Y;
      $strz    = $value-&gt;Z;
      if($key == "A") {
          $strA = $value-&gt;C;
      }
      if($key == "B") {
          $strB = $value-&gt;D;
      }
      $str1    = $value-&gt;1;
      $str2    = $value-&gt;2;
      $str3    = $value-&gt;3; 
  }
  </code></pre>