I have used inline PHP in HTML, the file extension is .php and it does not seem to work in both cases
<li><a href="<?php echo $link; ?>index.php">Home<?php echo "home";?></a></li>
where $link is defined as
<?php
$link="pages/";
?>
Thank you in advance.