title: php continue "foreach" after return
body: <p>I am working on a <strong>WordPress</strong> plugin for a specific theme but have a general question,<br>
  I have an array and want to do something with each object and return the result.<br>
  everything is Ok but the "<strong>foreach</strong>" only works for the first object of array and I think its because of "<strong>return"</strong> but for some reasons I cannot use "<strong>echo</strong>" instead of return.<br>
  this is my code:</p>
  
  <pre><code>    $cast_list = array(
          "composite_cast",
          "graphic_designer_cast",
          "product_manager_cast",
          "render_cast",
          "the3d_cast",
          "story_board_cast"
      );
  
      foreach ($cast_list as $value)
      {
          $user_field = get_field($value);    
      }
  
      return $user_field;
  } 
  </code></pre>
  
  <p>I have read other similar topics but passing the variable to another function to do the "return" job for me also not works</p>