PHP Basic Syntax

Introduction: This tutorial will cover the basic syntax of PHP files. What is syntax? Syntax is defined as "the structure of statements in a computer language." and as such refers to the format of the given scripts. Importance of correct syntax Having correct syntax in any script is extremely important. If a script has just one syntax error it could produce a lot of further problems and cause a fair bit of damage. Line Terminators A line terminator is a character which is used to signify the end of a scripting line - this excludes blank lines, comments, method/function starting lines, and lines only consisting of curly braces. In PHP the line terminator is a semi-colon (;). PHP Placement Any PHP scripting must be placed between PHP tags - the ending tag is "?>" while the starting tag can be "Examples/Samples: PHP Tags: Starting:
  1. <?php
Starting #2:
  1. <?
Ending:
  1. ?>
Line Terminator:
  1. ;

Add new comment