Alternative to storing html in php strings
<p>I'm looking for a better way to generate dynamic html from php.</p>

<p>Before I would do something like this:</p>

<pre><code>//generate.php
for(...)
{
    $markup .= '&lt;a id="'.$i.'"&gt;link'.$i.'&lt;/a&gt;';
}
</code></pre>

<p>This is really ugly, and I would much prefer not to have to define my markup inline in php strings.</p>

<p>I am looking for the functionality of <code>include "markup.php";</code>, but I need to be able to store the result into a string, and not output it right away. Something like below would be excellent.</p>

<pre><code>//generate.php
for(...)
{
    $markup .= include "markup.php";
}

//markup.php
&lt;a id="&lt;?=$i?&gt;"&gt;link&lt;?=$i?&gt;&lt;/a&gt;
</code></pre>
