title: store multiple values in associative array and return that array in php
body: <p>I have seen a lot of answers (so please don't mark it duplicate) to store  values in associative array but I want to return that array in PHP. Here is my code. It prints all values but only return the first value. I want the whole array returned to use in another function. </p>
  
  <p>Please help</p>
  
  <pre><code>function xml_parsing($response,$size,$array)
  {
      for($k=0;$k&lt;$size;$k++)
      {
          $price=(string)$response-&gt;Items-&gt;Item[$k]-&gt;ItemAttributes-&gt;ListPrice-&gt;FormattedPrice; 
          $myarray[$k]=explode(',',$array["ItemId"]);
          $update_fields=array('sku','price');  
          if($price=='') 
          {
              $Col_array=array('sku'=&gt;"".$myarray[$k][$k]."",'price'=&gt;"-1");
          }
          else
          {
              $price_trimed=ltrim($price,'$');
              $Col_array=array('sku'=&gt;"".$myarray[$k][$k]."",'price'=&gt;$price_trimed); 
              // I store the values here using a loop
          }
      }
      print_r($Col_array);
      return $col_array; //but here it return only first value
                         // But I want to return the whole array**
                         // I can't return it inside loop because it terminates 
                         // the loop and the function                               
  }  
  </code></pre>