Normally PHP script block starts with <?php and ends ?> and it can be embedded with HTML. PHP block can be placed anywhere in the document either with html tags or not. 
HTML Embeded php code
<html>
  <head>
    <title>This is my First PHP Program</title>
  </head>
  <body>
    <?php
      echo "This is my First PHP Program";
    ?>
  </body>
</html>
Pure PHP Code
<?php
      echo "This is my First PHP Program";
?>
Shorthand PHP Code
Following code executed when the shorthand mood enabled in the server.
<? echo "This is my First PHP Program"; ?>
It is necessary to specify extention of the php file name as ".php" other wise php scrip does not execute. 
Ex: Hello.php
No comments:
Post a Comment