meto
Healer Extraordinaire
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
100 XP
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 "<?pphp" or "<?" (without quotes). As well as between PHP tags, PHP scripts can not be placed in standard .htm/.html documents otherwise it will just display all content (tags included) as text.
<strong>Examples/Samples:
PHP Tags:
Starting:
Starting #2:
Ending:
Line Terminator:
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 "<?pphp" or "<?" (without quotes). As well as between PHP tags, PHP scripts can not be placed in standard .htm/.html documents otherwise it will just display all content (tags included) as text.
<strong>Examples/Samples:
PHP Tags:
Starting:
- <?php
Starting #2:
- <?
Ending:
- ?>
Line Terminator:
- ;