title: Putting php foreach into single variable comma separated string
body: <p>Hi this is probably really basic but cant do it for the life off me.</p>
  
  <p>i have a foreach outputting values.</p>
  
  <pre><code>$tags = get_the_tags(); 
  
  foreach($tags as $v) {
  
      echo $v;
  }
  </code></pre>
  
  <p>this will output </p>
  
  <pre><code>php,css,cms,seo
  </code></pre>
  
  <p>i need to put all those into a single variable so i can do the following.</p>
  
  <pre><code>$keywords = "&lt;meta name='keywords' content='".$tags."'&gt;";
  return $keywords;
  </code></pre>
  
  <p>can someone help i have tried</p>
  
  <pre><code> $keywords = "&lt;meta name='keywords' content='".foreach($tags as $v) {echo $v;}."'&gt;";
      return $keywords;
  </code></pre>
  
  <p>obviously getting errors from this and its wrong how is it done???</p>
  
  <p>Thanks</p>