s0c0 Posted March 5, 2008 Share Posted March 5, 2008 Does this exist? I have a class that outputs lots of HTML and I would like to make it pretty under the hood by properly indenting my HTML. Why you ask? Because I am seriously that anal. Is there something easy that will do this for me? I was thinking there would be something like \n or \r except like \t or \i that does a tab/indent. Seriously nothing pisses me off more than when a developer outputs an assload of HTML via PHP you view source and its one long unreadable line. Thanks. Quote Link to comment Share on other sites More sharing options...
maexus Posted March 7, 2008 Share Posted March 7, 2008 I thought \t worked. I'm at work so I can't test it. You could just tab in the string itself. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 8, 2008 Share Posted March 8, 2008 <?php echo "<table border='1'>\n"; echo "\t<tr>\n"; echo "\t\t<td>Hello World</td>\n"; echo "\t</tr>\n"; echo "</table>\n"; ?> Gives --> <table border='1'> <tr> <td>Hello World</td> </tr> </table> But so would this, and it's more readable <?php echo "<table border='1'> <tr> <td>Hello World</td> </tr> </table>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.