0% found this document useful (0 votes)
158 views

PHP Help Sheet

The document contains a reference sheet with information about various PHP functions organized into categories like array functions, date formatting, regular expressions, strings, files, and more. It includes syntax examples and descriptions of what each function does.

Uploaded by

granden
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views

PHP Help Sheet

The document contains a reference sheet with information about various PHP functions organized into categories like array functions, date formatting, regular expressions, strings, files, and more. It includes syntax examples and descriptions of what each function does.

Uploaded by

granden
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

GoSquared PHP Help Sheet

Array functions Regex Syntax (POSIX) Date Formatting Regex funcs


array_diff(arr1, arr2...) ^ Start of a string Day ereg(pattn, str)
array_filter(arr, function) $ End of a string D Short textual day Fri split(pattn, str)
array_flip(arr) . Any single character ll Long textual day Friday ereg_replace(p, r, s)
array_intersect(arr1, arr2) (a|b) a or b d Day [leading zeros] 01 to 31 preg_grep(ptn, arr)
array_merge(arr1, arr2...) (...) Group selection jJ Day 1 to 31 preg_match(p, str)
array_pop(arr) [abc] Item in range (a or b or c) w Day of week * 0 to 6 preg_match_all(p,s,a)
array_push(arr, var1...) [^abc] Not in range (not a or b or c) z Day of year 0 to 365 preg_replace(p,r,s)
array_reverse(arr) \s White space S Ordinal Suffix st, nd, td, th preg_split(ptn, str)
array_search(needle, arr) a? Zero or one of a N ISO-8601 numeric 1 (Mon) - 7
array_walk(arr, function) a* Zero or more of a (Sunday) Strings
count(arr) a+ One or more of a Week
in_array(needle, arr) a{3} Exactly 3 of a W Week of year ** 1 to 53 Hashing
a{3,} 3 or more of a crypt(str, [salt])
a{3,6} Between 3 or 6 of a md5(str, [raw])
Date + Time Month
\ Escape character sha1(str, [raw])
F Long textual month January
checkdate(m, d, y) [:punct:] Any punctuation symbol Manipulation
M Short textual month Jan
date(format, timestamp) [:space:] Any space character explode(sep, str)
m Month [leading zeros] 01 to 12
getdate(timestamp) [:blank:] Space or tab implode(glue, str)
n Month 1 to 12
mktime (h, min, s, m, d, yr) t No. days in current month 28 to 31 nl2br(str)
strftime(format, tmstmp) PCRE Modifiers sprintf(format)
strtotime(str) Year strip_tags(str)
i Case-insensitive
time() Y 4 digit year 2008 str_replace(n, r, str)
s Period matches new line
y strrev(str)
m ^ and $ match lines 2 digit year 08
strtolower(str)
Filesystem U Ungreedy matching L Leap year 1 or 0
strtoupper(str)
e Evaluate replacement o ISO-8601 year number 2008
clearstatscache() substr(str, start, len)
copy(source, destination) x Pattern over several lines Search
Time
fclose(handle) h 12 Hour [leading zeros] 01 to 12 strstr(str, needle)
fgets(handle, length) Useful Global variables g 12 Hour 1 to 12 strpos(str, needle)
file(file) H 24 Hour [leading zeros] 00 to 23
filemtime(file) $_SERVER[’DOCUMENT_ROOT’] G 24 Hour 0 to 23 Mathematics
filesize(file) $_SERVER[’REQUEST_METHOD’] i i Minutes [leading zeros] 00 to 59 bindec(binary_str)
file_exists(file) $_SERVER[’REQUEST_TIME’] s Seconds [leading zeros] 00 to 59 decbin(number)
file_get_contents(file) $_SERVER[’QUERY_STRING’] aa 12-hour period am or pm dechex(number)
fopen(file, mode) $_SERVER[’HTTP_REFERER’] A Uppercase 12-hour period AM or PM
decoct(number)
fread(handle, length) $_SERVER[’HTTP_USER_AGENT’] B Swatch Internet Time 000 to 999
s Microseconds 54321 deg2rad(number)
fwrite(handle, str) $_SERVER[’REMOTE_ADDR’]
exp(arg)
readfile(file) $_SERVER[’REQUEST_URI’]
Timezone floor(value)
T hexdec(hex_str)
Timezone of machine GMT
fopen() MODES Z Timezone offset [seconds] mt_rand(min, max)
Shell -43200 - 50400
octdec(octal_str)
r Read O Difference to GMT [hours] +0200
escapeshellcmd(cmnd) r+ Read and write, prepend I Daylight savings 1 or 0
exec(command) w Globals
Write, truncate U No. Seconds since Epoch *** 1218055418
shell_exec(command)
w+ Read and write, truncate c ISO 8601 date [PHP 5]
system(command) $_SERVER
a Write, append 2008-10-08T15:19:21+00:00 $_GET
a+ Read and write, append r RFC 2822 formatted date $_POST
Session
Wed, 14 Sept 2008 16:01:07 +0200 $_FILES
session_destroy() Comparison Operators $_REQUEST
session_id() * date(”w”): 0 is Sunday, 6 is Saturday. $_SESSION
!= Not equal
session_start() $_COOKIE
== Equal ** Week that overlaps 2 years belongs to year
session_regenerate_id() $_ENV
=== Identical that contains most days of that week. So week
session_unset()
!== Not Identical number for 1st January of a given year can
>= More than or equal return 53rd week if week belongs to previous
Miscellaneous <= Less than or equal year. date(”W”, mktime(0, 0, 0, 12, 8, $year))
set_time_limit(seconds) > More than returns correct number of weeks in $year
ini_set(setting, value) < Less than
*** The Epoch was the 1st January 1970.

Download this Help Sheet now at gosquared.com/liquidicity or put it on your wall © 2008 Go Squared Ltd.

You might also like