Sei sulla pagina 1di 1

Array Functions Regular Expression Functions Date Formatting

array_diff (arr1, arr2 ...) ereg (pattern, str) Y 4 digit year (2008)
array_filter (arr, function) split (pattern, str) y 2 digit year (08)
array_flip (arr) ereg_replace (pattern, replace, str) F Long month (January)
array_intersect (arr1, arr2 ...) preg_grep (pattern, arr) M Short month (Jan)
array_merge (arr1, arr2 ...) preg_match (patten, str) m Month 4
(01 to 12)
array_pop (arr) preg_match_all (pattern, str, arr) n Month (1 to 12)
array_push (arr, var1, var2 ...) preg_replace (pattern, replace, str) D Short day name (Mon)
array_reverse (arr) preg_split (pattern, str) l Long day name (Monday)
array_search (needle, arr) d Day 4
(01 to 31)
array_walk (arr, function) j Day (1 to 31)
Regular Expressions Syntax
count (count)
in_array (needle, haystack) ^ Start of string h 12 Hour 4
(01 to 12)
$ End of string g 12 Hour (1 ro 12)
. Any single character H 24 Hour 4
(00 to 23)
String Functions
(a|b) a or b G 24 Hour (0 to 23)
crypt (str, salt) (...) Group section i Minutes 4
(00 to 59)
explode (sep, str) [abc] Item in range (a, b or c) s Seconds 4
(00 to 59)
implode (glue, arr) [^abc] Not in range (not a, b or c)
nl2br (str) \s White space w Day of week 1
(0 to 6)
sprintf (frmt, args) a? Zero or one of a z Day of year (0 to 365)
strip_tags (str, allowed_tags) a* Zero or more of a W Week of year 2
(1 to 53)
str_replace (search, replace, str) a*? Zero or more of a, ungreedy t Days in month (28 to 31)
strpos (str, needle) a+ One or more of a
strrev (str) a+? One or more of a, ungreedy a am or pm
strstr (str, needle) a{3} Exactly 3 of a A AM or PM
strtolower (str) a{3,} 3 or more of a B Swatch Internet Time (000 to 999)
strtoupper (str) a{3,6} 3 to 6 of a S Ordinal Suffix (st, nd, rd, th)
substr (string, start, len) a{3,6}? 3 to 6 of a, ungreedy
\ Escape character T Timezone of machine (GMT)
Z Timezone offset (seconds)
Filesystem Functions
[:punct:] Any punctuation symbol O Difference to GMT (hours) (+0200)
clearstatcache () [:space:] Any space character I Daylight saving (1 or 0)
copy (source, dest) [:blank:] Space or tab L Leap year (1 or 0)
fclose (handle)
fgets (handle, len) U Seconds since Epoch 3
PCRE Modifiers
file (file) c ISO 8601 (PHP 5)
filemtime (file) i Case-insensitive r RFC 2822
filesize (file) s Period matches newline
file_exists (file) m ^ and $ match lines 1. 0 is Sunday, 6 is Saturday.
fopen (file, mode) U Ungreedy matching
fread (handle, len) e Evaluate replacement 2. Week that overlaps two years belongs
fwrite (handle, str) x Pattern over several lines to year that contains most days of that
readfile (file) week. Hence week number for 1st
January of a given year can be 53 if
Date and Time Functions
week belongs to previous year.
fopen() Modes
date (format, timestamp) date("W", mktime(0, 0, 0, 12, 8,
r Read mktime (hr, min, sec, month, day, yr) $year)) always gives correct number
r+ Read and write, prepend strtotime (str) of weeks in $year.
w Write, truncate time ()
w+ Read and write, truncate 3. The Epoch is the 1st January 1970.
a Write, append Available free from
a+ Read and write, append AddedBytes.com 4. With leading zeroes

Potrebbero piacerti anche