title: How to print a single JSON element
body: <p>I'm new to JSON, but I'm trying to figure out but I'm getting an error for a simple print out. </p>
  
  <p>I want to print out the score as an easy start. I've been reading about JSON and I don't see what im doing wrong.</p>
  
  <p><strong>Error Message:</strong></p>
  
  <p>PHP Warning:  Invalid argument supplied for foreach() in /testing.php on line 11</p>
  
  <pre><code> &lt;?php
  
  
  $string = file_get_contents('URL');
  
  $json = json_decode($string);
  
  
  foreach ($json['pos'] as $score)
    {
     echo "pos:". $score['score'] ."\n";
    };
  
  print_r($json);
  
    ?&gt;
  
  
    {
    "pos": [
     {
       "pos": "1",
       "name": "Sarah",
       "game": "a",
       "score": "-10",
       "examscore": "-5"
     },
     {
       "pos": "T2",
       "name": "Brian ",
       "game": "F*",
       "score": "-8",
       "examscore": "-3"
     },
      {
      "pos": "T2",
       "name": "Joe",
       "game": "F*",
       "score": "-8",
       "examscore": "-1"
     },
    {
       "pos": "WD"
    }
   ] 
    }
  </code></pre>