title: How to return multiple values in a WordPress function involving multiple get_terms()
body: <p>The intention is to generate a html table with information retrieved by the WordPress function <code>get_terms</code>.  It creates an tabulated icon legend, and presents it in html.  Here, I am creating a short-code to call on this function where needed.</p>
  
  <p>However, new to PHP programming, I don't know how to implement this correctly, as I am facing a constraint in PHP programming in which a function cannot return multiple values.  Please amend the following code to implement its intention, which I believe is clear, even though the code is invalid.</p>
  
  <pre><code>&lt;?php
  // Custom function to compile post icons legend table - added by you 18 Dec 2017
  function compile_post_icons_legend_table() {
      return'&lt;div class="narrowed"&gt;
      &lt;h2 class="right-widget-title"&gt;Post Icons Legend&lt;/h2&gt;
      &lt;table class="post-icons-legend"&gt;';
  
      $terms = get_terms([
          'taxonomy' =&gt; 'std_or_youtube',
          'hide_empty' =&gt; false,
      ]);
      foreach ( $terms as $term ) {
          return '&lt;tr&gt;&lt;td&gt;&lt;div class="small-svg-icon-container"&gt;&lt;svg&gt;&lt;use width = "24" height ="24" xlink:href="https://www.ashenglowgaming.com/wp-content/plugins/wp-svg-spritemap-master/defs.svg#:'.$term-&gt;slug.'"&gt;&lt;/svg&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;'.$term-&gt;description.'&lt;/td&gt;&lt;/tr&gt;';
  }
  
      $terms = get_terms([
          'taxonomy' =&gt; 'content',
          'hide_empty' =&gt; false,
      ]);
      foreach ( $terms as $term ) {
          return '&lt;tr&gt;&lt;td&gt;&lt;div class="small-svg-icon-container"&gt;&lt;svg&gt;&lt;use width = "24" height ="24" xlink:href="https://www.ashenglowgaming.com/wp-content/plugins/wp-svg-spritemap-master/defs.svg#:'.$term-&gt;slug.'"&gt;&lt;/svg&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;'.$term-&gt;description.'&lt;/td&gt;&lt;/tr&gt;';
  }
      return
      '&lt;/table&gt;
      &lt;/div&gt;';
  }
  add_shortcode('post_icons_legend_table', 'compile_post_icons_legend_table');
  ?&gt;
  </code></pre>