Introduction to PHP.
General
-
PHP scripts:
-
Embedded in HTML documents
-
The <script> tag can be used but cumbersome
-
The embedding tag <?php and ?>
The only way that it will work with XML and XHTML documents
-
In files that are referenced by HTML documents
-
Using the include command:
include("table2.inc");
Content of file table2.inc are copied into the document where the call appears
PHP preprocessor changes from interpreter to copy mode when an include is encountered
-
All variable in PHP begin with the dollar sign ($)
-
Followed by a letter or underscore, followed by any number of letters, digits, or underscores
-
Variable names are case sensitive
-
Neither reserved names nor functions are case sensitive
The reserved words of PHP
and
|
else
|
function
|
not
|
this
|
break
|
elseif
|
global
|
or
|
true
|
case
|
extends
|
if
|
require
|
var
|
class
|
false
|
include
|
return
|
virtual
|
continue
|
for
|
list
|
static
|
xor
|
do
|
|
|
|
|
|
|
|
|
|
-
PHP Comments:
-
Single-line comments: Specified with $ as in Perl
-
Single-line comments: Specified with // as in JavaScript
-
Multiple-line comments: Specified with /* and */ as in JavaScript
-
PHP statements terminated with a (;)
-
Braces used to form compound statements for control structures
Braces cannot define blocks with logically scoped variables,
unless it is the body of a function
| Origins and Uses of PHP |
| Overview of PHP |
| General Syntactic Characteristics |
| Primitives, Operations, and Expressions |
| Output |
| Control Statements |
| Arrays |
| Functions |
| Pattern Matching |
| Form Handling |
| Files |
| Cookies |
| Session Tracking |