Machine Guy Machine Guy - 29 days ago 14
PHP Question

show php variable in html heading

i want to print a php variable in the html h1 tag. Important thing to know is that html is defined within the php as follow:

<?php


$test=" <html>

<h1><?php echo (rand(10,1000000)); ?></h1>

</html> ";
echo $test;

?>

Answer Source

use the following

<?php
  $a="hi";
  $prints =" <html>
               <h1> $a</h1>
             </html>";
 echo"$prints";
?>