JavaScript Tutorial

PHP Syntax

Here we will discuss the basic syntax of writing PHP code.

PHP script starts and ends as follows:

<?php            //php opening tag

?>           //php closing tag

PHP parser interprets the code in between these tags and everything that is written beyond these tags is simply ignored by the parser.

Short echo tags

Short echo tags are used as a shorthand operator of <?php echo. It looks like:

Short open tags

We can also use the short-open tags. The syntax looks like:

However, we need to check the configuration file i.e. php.ini for the status of short-open tags because they could have been disabled via short_open_tag.

Go back to Previous Course