Thursday, 2 July 2015

PHP Syntax

What are the Syntax of PHP?
  • Syntax: As we already told that much of the syntax of PHP is borred from C,so  PHP syntax is the same as in C: Code is blank insensitive, statements are terminated with semicolons, function calls have the same structure (my_function(expression1, expression2)), and curly braces ({ and }) create statements into blocks. PHP supports C and C++-style comments (/* */ as well as //), and additionally Perl and shell-script vogue (#).
    $sign: As all variable declare in PHP by $ symbol
  • Basically in PHP most of the syntax is borrowed from C, Java, and Pearl with couple of unique PHP- specific features thrown in.
  • PHP statement is terminated by semicolon (“;”).
  • the basic syntax of PHP is start < ?php with  and end with ?>.
    < ?php
           echo “statement”;
     ?>

PHP Comments:

There are two types of comments:

Single Line Comments

This represents the small notes or short notice.example of  Single Line Comment is shown below:
 <?       # This is a  comment
      // This is also a comment .
  ?>

Multiline comments

This represents the more detail notes and explanations example: of Multiline comment is shown below:

 <?
/* This is a multiline comment
Name: Jazz Williams
Purpose: Demo of Multiline Comments
Subject: PHP Tutorials
*/
?>

No comments:

Post a Comment