What are some best practices for formatting code output in PHP?

When formatting code output in PHP, it is important to ensure readability and maintainability. One best practice is to use proper indentation and spacing to make the code more organized and easier to follow. Additionally, consider using syntax highlighting to differentiate between different elements in the code. Lastly, use comments to explain complex logic or functionality within the code.

<?php

// Proper indentation and spacing
echo "Hello, World!";

// Syntax highlighting
echo "<p style='color: red;'>Error message</p>";

// Comments to explain logic
// Calculate the sum of two numbers
$number1 = 5;
$number2 = 10;
$sum = $number1 + $number2;
echo "The sum of $number1 and $number2 is $sum";

?>