What are the differences between using PHP and HTML for text alignment?

When aligning text in HTML, you can use CSS properties like text-align to control the alignment. In PHP, you can dynamically generate HTML code and include the necessary CSS properties for text alignment within the generated HTML.

<?php
$alignment = "center"; // Set the desired alignment (e.g., center, left, right)

echo "<div style='text-align: $alignment;'>Text alignment in PHP!</div>";
?>