You can insert newline characters that will be displayed in the HTML source code, including literal carriage returns in your PHP lines, for example:
$count1 = '1'; $count2 = '2'; /* Note the opening single quote in the next line of code is closed on the following line, so the carriage return at the end of that line is part of the string */ echo '<table> <tr><td>This is row</td><td>' , $count1 , '</td><td>and</td></tr> <tr><td>this is row</td><td>' , $count2 , '</td><td> </td></tr> </table>';
displays
This is row 1 and this is row 2
as expected, but the source code will be presented as:
<table> <tr><td>This is row</td><td>1</td><td>and</td></tr> <tr><td>this is row</td><td>2</td><td> </td></tr> </table>
Perhaps a trivial example, but when you repeat a large line with multiple lines (like a table), it is easier to debug the HTML source if these line breaks are present. Note that if you insert tabs or spaces inside these lines, the HTML code will also have these indents. Of course, the browser will hide all of them in one space, but this will simplify the execution of HTML code.
Steve gs
source share