You can insert the PHP code in between of your HTML code. An extension of a PHP file is “.php”. We can start out PHP code using “<?php” and in the end “?>” (Please ignore double quotes).
Just look this example that shows how we can insert the PHP code in between of HTML Code.
<html> <head> <title>Hello World</title> </head> <body> <?php echo ‘This is my first dynamic line of PHP’; ?> </body> </html>
This is my first dynamic line of PHP.
Remember Always: PHP statements always end with a semi-colon.
Comments are generally use by the programmers itself for make the
code easily understandable for future corrections, optimizations
In the large web applications like e-commercial application, the PHP developers make the comment for their developed PHP code. These comments can represent what the particular code is doing? And what is the flow of that PHP code?
<html> <head> <title>Hello World</title> </head> <body> <?php //This is the single line comment echo 'This is my first dynamic line of PHP'; /* This is the multiline comment @Author Javatportal.com echo 'This is the second echo statement of this code'; */ ?> </body> </html>
This is my first dynamic line of PHP
The above code will not execute the second echo statement because that statement we mentioned in comments section and comment section does not execute anything
Of course PHP is not fully case-sensitive scripting language but the variables name are case sensitive. Just look these following examples.
<html> <head> <title>Hello World</title> </head> <body> <?php $age=22; echo 'My age is '. $Age . "
My age is
My age is
My age is 22
In the above examples the variables $age, $Age and $AGE considered as three different variables and all echo statements will print because the keywords, functions, object, classes are not case sensitive.