PHP 5 Syntax

We all know PHP is executed on the server and result of php will reflect on web browser using HTML

PHP Syntax:

<?php

---------
---------  [php code written here]
---------

?>

PHP can be run only through .php files.Php code is written in between html tags to echo the results.
In PHP to result the output ,It has built in functions “ECHO”.

Example for a simple program in php:

<?php

    Echo “Hai welcome to PHP Unlimited”;

 ?>

PHP in Between HTML Tags:

<!DOCTYPE html>
<html>
<body>
<?php 

        echo “Welcome to PHP Unlimited”  ;

 ?>
</body>
</html>

Note:Every PHP Statement ends with Semicolon(;)


Comments in PHP:

Basically comments in programming languages are written for easy understanding of flow of code. Comments are not executed by the programming language and can be read by the user. Comments will remind the user about the requirement of the particular code written by the user.

In PHP comments are two types

1.single line comments (// or # --- is used)
2.Multiline comments(/*   -----*/)

<?php

        // PHP code begins here (Single line comments)
        # This line is also single line comments
        /*
                Multiple lines are commented here
                Comments
                Welcome to php unlimited
        */
       
?>

Next Chapter: PHP Case-Sensitive

Comments

Popular Posts

Basic Introduction to PHP

PHP Variables Are Case-Sensitive