You can insert PHP Scripts anywahre in HTML Ducuments. When PHP Engine execute the Php file on server in HTML formate then HTML file send back to Browser.
PHP tag style:
The most effective PHP tag style is:
The default file extension for PHP files is ".php"
Below, see the hello.php file with PHP and HTML Scripts to print Varun Singh Tech Blog PHP script!
<html> <body> <?php echo "Varun Singh Tech Blog PHP script!"; ?> </body> </html>
PHP Comments Syntax:
A comments is a line of code that is visible only in the source code to increase the readability for programmers and disable before displaying the programs output. There are two comments formats in PHP:
• Single-line comments: They are generally used for short explanations
<html> <body> <?php // This is a single line comment # This is also a single line comment ?> </body> </html>
• Multiple line comments: They are generally used for more detailed explanations when necessary.
<html> <body> <?php /* This is a multiple lines comment block that spans over more than one line */ ?> </body> </html>
PHP is case sensitive:
PHP is a case sensitive language. If You use two variables with same name but with diffrent case the result will be not same. Try out following example:
<html> <body> <?php $name="Varun"; echo "My name is " . $name . "<br>"; echo "My surname is " . $NaMe . "<br>"; ?> </body> </html>
This will produce following result:
My name is Varun My name is
<html> <body> <?php echo "My first PHP script!"; ?> </body> </html>
Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section. We will be very happy to hear that.