title: foreach loop through json values
body: <p>I have a json result from an URL:</p>
  
  <pre><code>{
          "result": [{
              "user.name": "Spider Man",
              "user": "a4ac7bfe6f581640a62d3c31be3ee4dc"
          }, {
              "user.name": "Bat Man",
              "user": "af406b85e4b13500b95fa1eeac1ce626"
          }, {
              "user.name": "Iron Man",
              "user": "18ed9aba4ffb07006979ab6ba110c757"
          }, {
              "user.name": "Ant Man",
              "user": "877a503a98cc4200b95f526ea1ece471"
          }, {
              "user.name": "Captain America",
              "user": "8ec0d9634f2f22004b19ca1f0310c791"
          }]
      }
  </code></pre>
  
  <p>How to create a foreach loop to get the following output:</p>
  
  <pre><code>Spider Man
  Bat Man
  Iron Man
  Ant Man
  Captain America
  </code></pre>
  
  <p>And the same for the user-values in the json. </p>
  
  <p>I tried following code but I can't figure it out:</p>
  
  <pre><code>$json = file_get_contents($queryURL, false, $context) or die ("keine verbindung");
  $array = json_decode($json, true);
  foreach($array as $data) {
      $data-&gt;user;
  }
  </code></pre>
  
  <p>Thanks for your help.</p>