If your HTML contains double quotes, you can wrap it in single quotes:
echo '<span class="label-' . $variable . '">' . $variable . '</span>';
Alternatively, you can do this inline by avoiding double quotes:
echo "<span class=\"label-$variable\">$variable</span>";
The use of double quotes also allows for special characters, such as \nand \t.
The documentation is your friend.
source
share