What is the correct way to include PHP variables in HTML elements like links and images?

When including PHP variables in HTML elements like links and images, you need to echo the variable within the HTML code using the PHP opening and closing tags. This allows you to dynamically insert the variable's value into the HTML element. Make sure to concatenate the variable with the surrounding HTML code to ensure proper formatting.

<?php
$variable = "example.jpg";
?>
<img src="<?php echo $variable; ?>" alt="Example Image">