PHP tutorial-PHP Basic syntax

PHP Basic syntax

In the previous post, you learn to create a simple first program in PHP. Now it is the time to understand the basic syntax of the PHP building block. PHP code needs to be written in <?php    ?> block. All statements (instructions) must end with semi-colon (;).
To write comments in PHP you will use // (for single comment) and /*  */ (for multiple lines comment). The PHP code block can be placed in the head section or body section of the web page.

<head><title> First PHP Program</title></head>
   echo "This is my first program with php."; //php code
/* you need to put your php code in <?php and ?> block . All statements (instructructs) must end with semi-colon(;). */


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.