This tutorial is all about PHP Syntax.
Before we proceed to code our PHP script, we need to understand first what is the syntax of coding a PHP script. A syntax is a rule that should be followed in order to write a properly structured code.
If you have a background in programming other programming languages such as Java, C, and Perl, you don’t have to worry more about the syntax, because their syntax is almost similar to PHP and only the difference is that the PHP code contains a Tag like as the given syntax below.
<? //take note that PHP shorthand require a support to be enabled on your local server. ?>
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
echo "PHP Programming is fun!";
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 they’re 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 a semicolon at the end of our statement to signifies the end of the PHP statement.
PHP Programming is fun!
Readers might read also: