title: Convert comma separated string into array
body: <p>I have a comma separated string, which consists of a list of tags and want to convert it to array to get a link for every tag.</p>
  
  <p>Example:</p>
  
  <pre><code>$string = 'html,css,php,mysql,javascript';
  </code></pre>
  
  <p>I want to make it like this:</p>
  
  <pre><code>&lt;a href="tag/html"&gt;html&lt;/a&gt;, &lt;a href="tag/css"&gt;css&lt;/a&gt;, &lt;a href="tag/php"&gt;php&lt;/a&gt;, &lt;a href="tag/mysql"&gt;mysql&lt;/a&gt;, &lt;a href="tag/javascript"&gt;javascript&lt;/a&gt;
  </code></pre>
  
  <p>So the result will be a string containing comma separated links with a space after each link and with no comma after the last link.</p>
  
  <p>I have this function where $arg = 'html,css,php,mysql,javascript':</p>
  
  <pre><code>function info_get_tags( $arg ) {
      global $u;
  
      $tagss = '';
      if ( $arg == '' ) {
          return '';
      } else {
          $tags_arr = explode( ',' , $arg );
          foreach ( $tags_arr as $tag ) {
              $tags = '&lt;a href="' . $u . 'tag/' . $tag . '/" title="' . $tag . '"&gt;' . $tag . '&lt;/a&gt;';
              $tagss .= $tags;
          }
  
          return $tagss;
      }
  }
  </code></pre>
  
  <p>This script works for me but without commas and spaces and if we add a comma and a space here:</p>
  
  <pre><code>$tags = '&lt;a href="' . $u . 'tag/' . $tag . '/"&gt;' . $tag . '&lt;/a&gt;, ';
  </code></pre>
  
  <p>we get commas and spaces but there will be a trailing comma after the last link.</p>