"php variable inside echo 'html code'" Answer’s


You concatenate the string by ending it and starting it again:

echo '
<a class="fragment" href="' . $url . '">

Though I personally prefer to stop the PHP tags and start them again (if I have a lot of HTML) as my IDE won't syntax highlight the HTML as it's a string:

        <a class="fragment" href="<?php echo $url; ?>">link</a>
Wednesday, March 31, 2021
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :