How can PHP variables be properly included in HTML attributes like href?

When including PHP variables in HTML attributes like href, you need to ensure that the variable is properly concatenated within the attribute value. This can be done by using the concatenation operator (.) to combine the variable with the surrounding HTML code.

<?php
$variable = "example";
?>
<a href="<?php echo 'https://www.example.com/' . $variable; ?>">Link</a>