What are some best practices for formatting text output in PHP, especially when incorporating CSS or HTML?

When formatting text output in PHP, especially when incorporating CSS or HTML, it is best practice to separate your PHP logic from your HTML presentation. This can be achieved by using PHP to generate the necessary data and then outputting it within HTML or CSS tags. Additionally, using PHP functions like `echo` or `print` to output text can help maintain readability and organization in your code.

<?php
// PHP logic to generate text
$text = "Hello, World!";

// Output the text within HTML tags
echo "<p style='color: blue; font-size: 20px;'>$text</p>";
?>