03- PHP Syntax


This tutorial is all about PHP Syntax.
Before we proceed coding our PHP script, we need to understand first what is the syntax of coding a PHP script. A syntax is a rules that should be followed in order to write a proper structured code.
If you have a background in programming other programming langauges such as Java, C and Perl, you don’t have to worry more about the sysntax, because their syntax is almost similar to PHP and only the difference is that the PHP code contain a Tag like as the given syntax below.

PHP Code:

  1. <!--?php //some statements here ?-->

For shorthand:

  1. &lt;? //take note that PHP shorthand require a support to be enabled on your local server. ?&gt;

In my experience, I strongly suggest that you must use a standard PHP syntax that includes <?php over shorthand code. This is to make sure that your scripts will run on other servers with different settings.

Here is the example PHP page with simple HTML

Before running this page in your browser, you need to save this file with .php extension(sample.php). As you observe in our code above, we included their a PHP command“echo” which we are going to discuss this in the later part of our tutorial. And just Java or C program, we need to add semicolon at the end of our statement to signifies the end of the PHP statement.

PHP Programming is fun!



Readers might read also:



Facebook Comments
Previous articleJustine’s Guest House Online Room and Reservation System
Next article04- PHP Comments
Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.