I have php file index.php
In this file to use html code I am doing:
index.php
echo '
<div>
<a class="fragment" href="">
<div>';
In href I want to put value of some php variable i.e. $url
How could be done?
is this correct way?
<a class="fragment" href="<?php echo $url; ?>">
You concatenate the string by ending it and starting it again:
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: