|
Code |
Description |
| and |
logical operators |
| $argv |
Array of arguments passed to the script. |
| as |
foreach |
| $argc |
Contains the number of command line parameters passed to the script (if run on
the command line) |
| break |
break ends execution of the current
for, foreach while,
do..while or switch structure.
|
| case |
switch |
| cfunction |
old function |
| class |
A class is a collection of variables and functions working with these
variables. A class is defined using the following syntax: |
| continue |
continue is used within looping structures to skip the
rest of the current loop iteration and continue execution at the beginning of
the next iteration.
|
| declare |
The declare construct is used to set execution
directives for a block of code. The syntax of declare is
similiar to the syntax of other flow control constructs:
|
| default |
switch |
| do |
do..while loops are very similar to while
loops, except the truth expression is checked at the end of each iteration
instead of in the beginning. |
| die() |
Alias of
exit() |
| echo() |
Output one or more strings |
| else |
Often you'd want to execute a statement if a certain condition is met, and a
different statement if the condition is not met. |
| elseif |
elseif, as its name suggests, is a
combination of if and else. |
| empty() |
Determine whether a variable is set |
| enddeclare |
|
| endfor |
PHP offers an alternative syntax for some of its control structures; namely,
if, while, for,
foreach, and switch. In each case, the basic
form of the alternate syntax is to change the opening brace to a colon (:) and
the closing brace to endif;, endwhile;,
endfor;, endforeach;, or
endswitch;, respectively. |
| endforeach |
PHP offers an alternative syntax for some of its control structures; namely,
if, while, for,
foreach, and switch. In each case, the basic
form of the alternate syntax is to change the opening brace to a colon (:) and
the closing brace to endif;, endwhile;,
endfor;, endforeach;, or
endswitch;, respectively. |
| endif |
PHP offers an alternative syntax for some of its control
structures; namely, if, while,
for, foreach, and
switch. In each case, the basic form of the alternate syntax is to
change the opening brace to a colon (:) and the closing brace to
endif;, endwhile;, endfor;,
endforeach;, or endswitch;,
respectively. |
| endswitch |
PHP offers an alternative syntax for some of its control structures; namely,
if, while, for,
foreach, and switch. In each case, the basic
form of the alternate syntax is to change the opening brace to a colon (:) and
the closing brace to endif;, endwhile;,
endfor;, endforeach;, or
endswitch;, respectively. |
| endwhile |
PHP offers an alternative syntax for some of its control structures; namely,
if, while, for,
foreach, and switch. In each case, the basic
form of the alternate syntax is to change the opening brace to a colon (:) and
the closing brace to endif;, endwhile;,
endfor;, endforeach;, or
endswitch;, respectively. |
| E ALL |
Constants |
| E PARSE |
Constants |
| E ERROR |
Constants |
| E WARNING |
Constants |
| eval |
Evaluate a string as PHP code |
| exit() |
Output a message and terminate the current script |
| extends |
class |
| FALSE |
Constants |
| for |
for loops are the most complex loops
in PHP. They behave like their C counterparts. The syntax of a for
loop is: |
| foreach |
PHP 4 (not PHP 3) includes a foreach
construct, much like Perl and some other languages. |
| function |
A function may be defined using syntax such as the following:
|
| $HTTP_COOKIE_VARS |
An associative array of variables passed to the current
script via HTTP cookies.
|
| $HTTP_GET_VARS |
An associative array of variables passed to the current script via the HTTP GET
method.
|
| $HTTP_POST_VARS |
An associative array of variables passed to the current script via the HTTP
POST method.
|
| $HTTP_COOKIE_FILES |
variables |
| $HTTP_ENV_VARS |
An associative array of variables passed to the current script via the parent
environment.
|
| $HTTP_SERVER_VARS |
An associative array of variables passed to the current
script from the HTTP server. These variables are analogous to the Apache
variables described above. |
| if |
The if construct is one of the most important features
of many languages, PHP included. |
| include() |
The
include() statement includes and evaluates the
specified file.
|
| include_once() |
The
include_once() statement includes and evaluates
the specified file during the execution of the script. |
| global |
variable scope |
| list() |
Assign variables as if they were an array |
| new |
class |
| not |
logical operators |
| NULL |
A NULL value (see the
null type).
|
| old_function |
The old_function statement allows
you to declare a function using a syntax identical to PHP/FI2 (except you must
replace 'function' with 'old_function'.
|
| or |
logical operators |
| parent |
You may find yourself writing code that refers to variables
and functions in base classes. This is particularly true if your derived class
is a refinement or specialisation of code in your base class.
|
| PHP_OS |
Constants |
| $PHP_SELF |
The filename of the currently executing script, relative to the document root.
If PHP is running as a command-line processor, this variable is not available.
|
| print() |
Output a string |
| require() |
The
require() statement replaces itself with the
specified file, much like the C preprocessor's #include
works. |
| require_once() |
The
require_once() statement replaces itself with
the specified file, much like the C preprocessor's #include
works, and in that respect is similar to the
require() statement. |
| return |
defined functions |
| static |
variable scope |
| switch |
The switch statement is similar to a
series of IF statements on the same expression. |
| stdClass |
class |
| $this |
items[$artnr] += $num |
| TRUE |
Constants |
| var |
$items; // Items in our shopping cart |
| xor |
logical operators |
| virtual() |
Perform an Apache sub-request |
| while |
while loops
are the simplest type of loop in PHP. |
| FILE |
Constants |
| LINE |
Constants |
| sleep |
magic functions |
| wakeup |
magic functions |