title: How to assign foreach loop to a variable?
body: <p>I have this following code.</p>
  
  <pre><code>$sn_count = 1;
    foreach($points as $point){
      echo "&lt;div class=\"points\"&gt;";
      echo "&lt;div class=\"serial\"&gt;".$sn_count."&lt;/div&gt;";
      echo "&lt;div class=\"pointsdesc\"&gt;";
      echo $point['points_description'];
      echo "&lt;/div&gt;&lt;/div&gt;";
      $sn_count++;
    }
  </code></pre>
  
  <p>Is it possible to assign the above code to a variable <code>$pointsvar</code> </p>
  
  <p>Everytime i use <code>$pointsvar</code> the above code should be printed. Please help.
  Thanks</p>