What are some common syntax errors to avoid when using echo to output HTML in PHP?

One common syntax error to avoid when using echo to output HTML in PHP is mixing double quotes and single quotes improperly. This can lead to unexpected behavior or errors in your HTML output. To avoid this, consistently use either double quotes or single quotes throughout your HTML strings.

// Incorrect mixing of double and single quotes
echo "<a href='https://www.example.com'>Example</a>";

// Correct usage of double quotes
echo "<a href=\"https://www.example.com\">Example</a>";

// Correct usage of single quotes
echo '<a href="https://www.example.com">Example</a>';