title: cURL and json data convert into array and get only temp data
body: <p>I am new using json data. I am trying to call an api using cURL and converting it into array. I just want the temp data using foreach loop. But i am getting Invalid argument supplied for foreach() error. My code</p>
  
  <pre><code>$cSession = curl_init(); 
  curl_setopt($cSession,CURLOPT_URL,"http://api.openweathermap.org/data/2.5/forecast/daily?q=dhaka%2Cbangladesh&amp;mode=json&amp;units=metric&amp;cnt=3");
  curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
  curl_setopt($cSession,CURLOPT_HEADER, false); 
  $result = curl_exec($cSession);
  
  curl_close($cSession);
  
  //echo $result;
  //$i = 3 as i am requesting 3 day data
  for ($i=0; $i &lt;3 ; $i++) { 
    foreach ($result as $value) {
      echo $value['temp'][0]['day'];
      echo $value['temp'][0]['min'];
  
      echo $value['temp'][0]['max'];
      echo $value['temp'][0]['night'];
      echo $value['temp'][0]['eve'];
      echo $value['temp'][0]['morn'];
    }
  }
  </code></pre>