title: How to pass a variable from a while loop into a function then echo back to the while loop. PHP
body: <pre><code>    &lt;?php
  $tubeid = array('vYoutubeid' =&gt; "z2RhMdOJKio",
                 'vYoutubeid2' =&gt; "Ty1Znqb-3z8",
                 'vYoutubeid3'  =&gt; "AbRO0wJJhww",
                  'vYoutubeid4'  =&gt; "AbRO0wJJhww");
  
  function youtube_video_duration($description) 
    {
    $video_id = $description;
   $data = @file_get_contents('http://gdata.youtube.com/feeds/api/videos/'
    . $video_id . '?v=2&amp;alt=jsonc');
    if ($data == FALSE) 
        return FALSE;
  
  
    $obj = json_decode($data);
    $dur= $obj-&gt;data-&gt;duration;
    return $dur;
     }
  
  while (list($item, $description) = each($tubeid))
      echo "$item: $description&lt;br&gt;";
      echo youtube_video_duration($description);
  </code></pre>
  
  <p>here's what I'm trying to do. </p>
  
  <p>Take the results from the array, While loop them show their value then take those values and run them through the function so i can return durations from youtube. </p>
  
  <p>I'm stuck. </p>