PHP – Syntax

We use opening tags i.e “<?php” to tell the interpreter to start parsing the code. And closing tag i.e “?>” to tell interpreter to stop parsing the code.

Syntax to write the php code is below:


echo “Your code goes here.”;


php code terminates with semi-colon(;) at the end of line.

PHP documents can look just like ordinary HTML documents, and the PHP interpreter will ignore everything that’s not within a set of the so-called PHP tags, which opens and ends our example.

You must save your file with extension (.php), Other wise your code will not be parsed.

Example 1 :

echo "This is basic way to write with php.";

Php code can be embeded anywhere in HTML document.
<?php this tag tells interpreter to parse code and send output back to browser.
echo construct outputs the string to page.
?> this tag tells interpreter to stop parsing.

We have just created our very first PHP example code page.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *