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. Link to comment https://forums.phpfreaks.com/topic/94452-php-indent-or-tab-character-kinda-of-like-n-only-indents/ 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. Link to comment https://forums.phpfreaks.com/topic/94452-php-indent-or-tab-character-kinda-of-like-n-only-indents/#findComment-486587 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>"; ?> Link to comment https://forums.phpfreaks.com/topic/94452-php-indent-or-tab-character-kinda-of-like-n-only-indents/#findComment-486614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.