What are the potential pitfalls of using <br> tags for formatting output in PHP?
Using <br> tags for formatting output in PHP can lead to messy and inconsistent code, as it mixes HTML markup with PHP logic. A better approach is to separate the PHP logic from the HTML markup by using PHP's echo or print functions to output content. This makes the code easier to read, maintain, and debug.
<?php
// Bad practice: using <br> tags for formatting output
echo "Hello <br>";
echo "World";
// Good practice: separating PHP logic from HTML markup
echo "Hello";
echo "<br>";
echo "World";
?>