title: Concatenating ECHO syntax in PHP
body: <p>I have made a small function (<a href="http://en.wikipedia.org/wiki/WordPress" rel="noreferrer">WordPress</a>), using <code>echo .</code></p>
  
  <pre><code>/* .. Some code */
  switch ($linktype) {
      case "next":
          echo '&lt;p class="next"&gt;' . previous_post_link('%link',''.$prevthumbnail.'') . '&lt;/p&gt;';
          break;
      case "prev":
          echo '&lt;p class="prev"&gt;' . next_post_link('%link',''.$nextthumbnail.'') . '&lt;/p&gt;';
          break;
  }
  /* .. Some other code*/
  </code></pre>
  
  <p>Using the "regular" concatenation syntax that I know...</p>
  
  <pre><code>echo '&lt;p class="next"&gt;'. previous_post_link('%link',''.$prevthumbnail.'') . '&lt;/p&gt;';
  </code></pre>
  
  <p>...produces...</p>
  
  <pre><code>&lt;p class="next"&gt;&lt;/p&gt;&lt; result of previous_post_link() &gt;
  </code></pre>
  
  <p>I obviously need <code>&lt;p class="next"&gt;&lt; result of previous_post_link() &gt;&lt;/p&gt;</code>. I have found some post suggesting to replace the dots <strong>('.')</strong> with commas <strong>(',')</strong>, so now I have...</p>
  
  <pre><code>echo '&lt;p class="next"&gt;' , previous_post_link('%link',''.$prevthumbnail.'') , '&lt;/p&gt;';
  </code></pre>
  
  <p>...which works. Is this a "correct" way to address the problem, or is this just a "hack" that works? Is there a better approach?</p>