What is the correct way to echo a variable as the src attribute in PHP?

When echoing a variable as the src attribute in PHP, you need to make sure to concatenate the variable within double quotes to properly include its value in the HTML output. This ensures that the variable's value is correctly interpreted as part of the src attribute.

<?php
// Variable containing the image file name
$imageName = "example.jpg";

// Echo the variable as the src attribute within double quotes
echo '<img src="' . $imageName . '" alt="Example Image">';
?>