• We just launched and are currently in beta. Join us as we build and grow the community.

PHP Basic Syntax

meto

Healer Extraordinaire
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
50
Likes
198
Bits
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:
  1. <?php

Starting #2:
  1. <?

Ending:
  1. ?>

Line Terminator:
  1. ;

 

452,496

338,535

338,543

Top