Tables

I l @ ve RuBoard

Through the course of this book, I have included a handful of tables of useful information. In this appendix, I combine these tables in one location as a convenient reference, and I've included a new one, listing operator precedence (see Tables C.1 through C.6 ).

Table C.1. This is a partial list of operator precedence from highest to lowest (for example, multiplication takes precedence over addition).
Operator Precedence
! ++ ”
*/%
+-.
< <= > >=
==!====
&&
=+=-=*=/=.=%=
and
xor
or
Table C.2. This is a reprint of the list of special characters used for defining regular expression patterns as first revealed in Chapter 8, Regular Expressions.
Special Characters for Regular Expression
Character Matches
. any character
^a begins with a
a$ ends with a
a+ at least one a
a? zero or one a
\n new line
\t tab
\ escape
(ab) ab grouped
ab a or b
a{ 2} aa
a{ 1,} a, aa, aaa, etc.
a{ 1,3} a, aa, aaa
[a-z] any lowercase letter
[A-Z] any uppercase letter
[0-9] any digit
Table C.3. Don't forget that PHP has already defined several character classes for you to use when creating regular expression patterns. Here are the primary ones.
Predefined Classes for Regular Expression
Class Matches
[[:alpha:]] any letter
[[:digit:]] any digit
[[:alnum:]] any letter or digit
[[:space:]] any white space
[[:upper:]] any uppercase letter
[[:lower:]] any lowercase letter
[[:punct:]] any punctuation mark
Table C.4. Which parameter you use when opening a file determines what exactly the PHP can do with that file ”write to, read from, and so forth.
File Modes
Mode Allows For
r Read from the file only.
w Write to the file only, but it will create the file if it doesn't exist or discard existing contents before writing (if the file does exist).
a Append new data to the end of the file and create the file if it doesn't exist.
r+ Read and write to the file.
w+ Read and write to the file, but it will create the file if it doesn't exist or discard existing contents before writing (if the file does exist).
a+ Read from and write to the file and create the file if it doesn't exist. New data will be appended to the end of file.
Table C.5. The various date formats may be the most common thing that I can never remember. Keep this table nearby when using the date() function.
Format Options with the date() Function
Character Format
a am or pm
A AM or PM
d day of the month as 2 digits with leading zeros: 01 to 31
D day of the week as 3 letters : Sun, Mon, etc.
F month, long-form : January
g hour of the day in 12- hour format without leading zeros: 1 to 12
G hour of the day in 24-hour format without leading zeros: to 23
h hour of the day in 12-hour format: 01 to 12
H hour of the day in 24-hour format: 00 to 23
i minutes: 00 to 59
j day of the month without leading zeros: 1 to 31
l (lowercase 'L') day of the week, long-form: Sunday
m month as 2 digits: 01 to 12
M month as 3 letters: Jan
n month as digits without leading zeros: 1 to 12
s seconds: 00 to 59
S English ordinal suffix as 2 characters: th, nd, rd, etc.
t number of days in the given month: 28 to 31
U seconds since the epoch
w day of the week as a single digit: (Sunday) to 6 (Saturday)
y year as 2 digits: 01
Y year as 4 digits: 2001
z day of the year: to 365
Table C.6. These error-reporting options come in handy both when you are initially developing a site and once it has gone live.
Error Reporting Levels
Number Constant Meaning
1 E_ERROR Fatal run-time
2 E_WARNING Non-fatal run-time warnings
4 E_PARSE Compile-time parse
8 E_NOTICE Run-time notices
16 E_CORE_ERROR fatal errors that occur during PHP's initial startup PHP 4 only
32 E_CORE_WARNING warnings (non fatal errors) that occur during PHP's initial startup PHP 4 only
64 E_COMPILE_ERROR fatal compile-time errors PHP 4 only
128 E_COMPILE_WARNING compile-time warnings (non fatal errors) PHP 4 only
256 E_USER_ERROR user -generated error message PHP 4 only
512 E_USER_WARNING user-generated warning message PHP 4 only
1024 E_USER_NOTICE user-generated notice message PHP 4 only
  E_ALL all of the above, as supported
I l @ ve RuBoard


PHP for the World Wide Web (Visual QuickStart Guide)
PHP for the World Wide Web (Visual QuickStart Guide)
ISBN: 0201727870
EAN: 2147483647
Year: 2001
Pages: 116
Authors: Larry Ullman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net