PHP Cheat Sheet: by Via
PHP Cheat Sheet: by Via
clearstatcache ()
Start of string
End of string
array_flip (arr)
fclose (handle)
(a|b)
a or b
file (file)
(...)
Group section
array_pop (arr)
filemtime (file)
[abc]
In range (a, b or c)
filesize (file)
[^abc]
Not in range
array_reverse (arr)
file_exists (file)
\s
White space
a?
Zero or one of a
a*
Zero or more of a
count (count)
a*?
readfile (file)
a+
One or more of a
a+?
a{3}
Exactly 3 of a
a{3,}
3 or more of a
a{,6}
Up to 6 of a
getdate (timestamp)
a{3,6}
3 to 6 of a
nl2br (str)
a{3,6}?
3 to 6 of a, ungreedy
Escape character
strtotime (str)
[:punct:]
time ()
[:space:]
[:blank:]
Space or tab
strrev (str)
strtolower (str)
strtoupper (str)
Pattern Modifiers
Global match
i*
Case-insensitive
m*
Multiple lines
s*
x*
at: http://regexpal.com/
pattern
Sponsored by Readability-Score.com
cheatography.com/davechild/
www.addedbytes.com
Page 1 of 2.
https://readability-score.com
e*
Evaluate replacement
U*
Ungreedy pattern
a
am or pm
AM or PM
Read
r+
Write, truncate
w+
Write, append
a+
Daylight saving (1 or 0)
Leap year (1 or 0)
* PCRE modifier
0 is Sunday, 6 is Saturday.
Month (1 to 12)
Day (1 to 31)
12 Hour (1 to 12)
24 Hour (0 to 23)
Day of week (0 to 6)
(2008-07-31T18:30:13+01:00)
r
Sponsored by Readability-Score.com
cheatography.com/davechild/
www.addedbytes.com
Page 2 of 2.
https://readability-score.com