What's the best way to format long strings of HTML in PHP?

Posted by dclowd9901 on Stack Overflow See other posts from Stack Overflow or by dclowd9901
Published on 2010-03-19T14:59:02Z Indexed on 2010/03/19 15:01 UTC
Read the original article Hit count: 263

I know it's really a subjective question, but for best-practices (and readability), I can't seem to get a fix on the best way to format long strings of HTML. I typically do it like this:

echo '
<div>
    <p>Content Inside</p>
    <div class="subbox">
        <ul>
            <li>etc.</li>
            <li>etc.</li>
            <li>etc.</li>
            <li>etc.</li>
        </ul>
    </div>
</div>
';

But I still don't like the outcome, especially if this appears in the middle of a large block of code. It just feels messy.

© Stack Overflow or respective owner

Related posts about php

Related posts about formatting