28 August 2018

What are PHP tags?

  • PHP code starts with start tag <?php and end with end tag ?>
  • PHP code can also start with short open tag <?  .To use this short tag you have to enable short_open_tag in php configuration file “php.ini
  • Before PHP version 7, PHP  also supported ASP tags <%, %>, ASP short open tag for <%=, and the script tag <script language="php"> which  has been removed from PHP version 7.
  • If  a PHP file have only PHP codes inside the file  then it is preferable to omit the PHP closing tag ?> at the end of the a PHP file.
  • Example of PHP Tag
  • 1
    2
    3
    4
    5
    <?php // Start PHP Tag
     echo "PHP is easy to learn !!";
     echo "PHP code is executed on web server !!";
    
     // End PHP Tag ?> 
    

  • Output of above PHP code:
    PHP is easy to learn !!PHP code is executed on web server !!

# Good book on PHP:



PHP for the Web: Visual QuickStart Guide (5th Edition)

No comments:

Post a Comment

Featured Post

How to Write PHP code and HTML code within a same file

A PHP file can have both PHP code and HTML code together. Any HTML code written outside of PHP <?php //php code here… ?> Code is ig...

Popular Posts