PHP Syntax
PHP script starts with <?php
PHP statement terminates by ;
And ends with ?>
Example:
<?php
//my first php prigramm
echo"Hello Word!";
?>
Output: Hello Word!
Here with above example you can see.
<?php It is used to start a php program.
// It is used to write comment.
echo It is used to display message.
"" It must be used to enclosed text/string.
; It is used to terminate the statement.
?> It is used to end php program.
# It can also use to write single line comment.
/*….. */ Use this to write multiple line comments
Comments are non executable statements in php nor it does increase execution time the only purpose to write is to let you and other understand what you did.
PHP is Case Sensitivity
NOT Case-Sensitive: User-defined Functions, Classes, and Keywords like if, else, while, echo, etc
Case-Sensitive: Variables
Example:
<?php
echo "My PHP script <br>";
echo "My PHP script <br>";
?> Output:
My PHP script
My PHP script
case-sensitive:
Suppose we can two variable names
$message
$MESSAGE
Only $message variable will print.
<?php
$message="Hello, it is my first PHP coding ";
$MESSAGE ="Hello, it is my first PHP coding";
Echo $message;
Echo $MESSAGE;
?>
Output: Hello, it is my first coding.
Output:
PHP script starts with <?php
PHP statement terminates by ;
And ends with ?>
Example:
<?php
//my first php prigramm
echo"Hello Word!";
?>
Output: Hello Word!
Here with above example you can see.
<?php It is used to start a php program.
// It is used to write comment.
echo It is used to display message.
"" It must be used to enclosed text/string.
; It is used to terminate the statement.
?> It is used to end php program.
# It can also use to write single line comment.
/*….. */ Use this to write multiple line comments
Comments are non executable statements in php nor it does increase execution time the only purpose to write is to let you and other understand what you did.
PHP is Case Sensitivity
NOT Case-Sensitive: User-defined Functions, Classes, and Keywords like if, else, while, echo, etc
Case-Sensitive: Variables
Example:
<?php
echo "My PHP script <br>";
echo "My PHP script <br>";
?> Output:
My PHP script
My PHP script
case-sensitive:
Suppose we can two variable names
$message
$MESSAGE
Only $message variable will print.
<?php
$message="Hello, it is my first PHP coding ";
$MESSAGE ="Hello, it is my first PHP coding";
Echo $message;
Echo $MESSAGE;
?>
Output: Hello, it is my first coding.
Output:
0 comments:
Post a Comment