What is the correct syntax to echo a variable value within an HTML attribute in PHP?

When echoing a variable value within an HTML attribute in PHP, you need to make sure to enclose the attribute value in quotes and concatenate the variable using the dot (.) operator. This ensures that the variable value is properly inserted into the HTML attribute without causing syntax errors.

<?php
$variable = "example";
echo "<a href='#' class='link' data-value='" . $variable . "'>Link</a>";
?>