SlideShare a Scribd company logo
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 (pattern, 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) (lowercase L)
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 to 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{,6}             Up to 6 of a                   S    Ordinal Suffix (st, nd, rd, th)
substr (string, start, len)                        a{3,6}            3 to 6 of a
                                                   a{3,6}?           3 to 6 of a, ungreedy          T    Timezone of machine (GMT)
                                                                    Escape character               Z    Timezone offset (seconds)
Filesystem Functions
                                                   [:punct:]         Any punctuation symbol         O    Difference to GMT (hours) (e.g., +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                    2008-07-31T18:30:13+01:00
filesize (file)                                    s                 Period matches newline         r    RFC 2822
file_exists (file)                                 m                 ^ and $ match lines                 Thu, 31 Jul 2008 18:30:13 +0100
fopen (file, mode)                                 U                 Ungreedy matching
fread (handle, len)                                e                 Evaluate replacement           1.   0 is Sunday, 6 is Saturday.
fwrite (handle, str)                               x                 Pattern over several lines
readfile (file)                                                                                     2.   Week that overlaps two years belongs
                                                                                                         to year that contains most days of that
                                                  Date and Time Functions
                                                                                                         week. Hence week number for 1st
fopen() Modes
                                                   checkdate (month, day, year)                          January of a given year can be 53 if
r                    Read                          date (format, timestamp)                              week belongs to previous year.
r+                   Read and write, prepend       getdate (timestamp)                                   date("W", mktime(0, 0, 0, 12, 8,
w                    Write, truncate               mktime (hr, min, sec, month, day, yr)                 $year)) always gives correct number of
w+                   Read and write, truncate      strftime (formatstring, timestamp)                    weeks in $year.
a                    Write, append                 strtotime (str)
a+                   Read and write, append        time ()                                          3.   The Epoch is the 1st January 1970.


                                Available free from AddedBytes.com                                  4.   With leading zeroes

More Related Content

What's hot (20)

PDF
Asymptotic notation
mustafa sarac
 
PPT
Asymptotic notations
Ehtisham Ali
 
PPT
Basics & asymptotic notations
Rajendran
 
PDF
Parameterized curves in r^3
Tarun Gehlot
 
PDF
Building Machine Learning Algorithms on Apache Spark: Scaling Out and Up with...
Databricks
 
PPT
lecture 4
sajinsc
 
PDF
Lista exercintegrais
Universidade de São Paulo USP
 
PPTX
Fourier Series for Continuous Time & Discrete Time Signals
Jayanshu Gundaniya
 
PDF
Ps02 cmth03 unit 1
Prakash Dabhi
 
DOCX
Asymptotic notations
V.V.Vanniaperumal College for Women
 
PDF
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 
PDF
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 
PDF
Mvtword
Mithun Agarwalla
 
PDF
Remark on variance swaps pricing
Ilya Gikhman
 
PDF
Notes 17
supoteta
 
PDF
Note on Character Theory-summer 2013
Fan Huang (Wright)
 
PPTX
Properties of Fourier transform
Muhammed Afsal Villan
 
PDF
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 
Asymptotic notation
mustafa sarac
 
Asymptotic notations
Ehtisham Ali
 
Basics & asymptotic notations
Rajendran
 
Parameterized curves in r^3
Tarun Gehlot
 
Building Machine Learning Algorithms on Apache Spark: Scaling Out and Up with...
Databricks
 
lecture 4
sajinsc
 
Lista exercintegrais
Universidade de São Paulo USP
 
Fourier Series for Continuous Time & Discrete Time Signals
Jayanshu Gundaniya
 
Ps02 cmth03 unit 1
Prakash Dabhi
 
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 
Remark on variance swaps pricing
Ilya Gikhman
 
Notes 17
supoteta
 
Note on Character Theory-summer 2013
Fan Huang (Wright)
 
Properties of Fourier transform
Muhammed Afsal Villan
 
Consistency proof of a feasible arithmetic inside a bounded arithmetic
Yamagata Yoriyuki
 

Viewers also liked (6)

PPTX
E learning excel vba programming lesson 4
Vijay Perepa
 
PDF
How to Design a Better BI and Analytics Experience for Everyone
ibi
 
PPTX
DV Analytics and SAS Training in Bangalore
DV Analytics
 
PPT
Dv Analytics Course Contents
DV Analytics
 
PDF
Excel vba
Yen_CY
 
PPTX
Using Vba Excel
Felix Andrian Prihatono
 
E learning excel vba programming lesson 4
Vijay Perepa
 
How to Design a Better BI and Analytics Experience for Everyone
ibi
 
DV Analytics and SAS Training in Bangalore
DV Analytics
 
Dv Analytics Course Contents
DV Analytics
 
Excel vba
Yen_CY
 
Using Vba Excel
Felix Andrian Prihatono
 
Ad

Similar to PHP Cheatsheet (20)

PDF
Php cheat sheet
Piyush Mittal
 
PDF
python-cheat-sheet-v1
Hiroshi Ono
 
PDF
PHP Cheat Sheet
GlowTouch
 
PPTX
Assignment 2 interview preparation work COSC1285
MadelineLong2
 
PDF
Regexps
Eugene Nizhibitsky
 
PDF
Expresiones Regulares
Juan Carlos Gonzales Vitte.
 
PPTX
Suffix arrays
Strand Life Sciences Pvt Ltd
 
PPTX
Programming data structure concept in array ppt
seetha394884
 
PDF
ANSI C REFERENCE CARD
Tia Ricci
 
PDF
Strings part2
yndaravind
 
PDF
Text Mining using Regular Expressions
Rupak Roy
 
PPTX
Presentation on Data transformation in Stata.
anshukgec1599
 
PDF
Hybrid Atlas Models of Financial Equity Market
tomoyukiichiba
 
PPTX
Module-2_Strings concepts in c programming
CHAITRAB29
 
PDF
Research Inventy : International Journal of Engineering and Science
researchinventy
 
PDF
STRING LIST TUPLE DICTIONARY FILE.pdf
omprakashmeena48
 
PPT
Unit3 jwfiles
mrecedu
 
PPT
C Language Unit-3
kasaragadda srinivasrao
 
PDF
2 homework
ジョ ビダル
 
PDF
Python lecture 05
Tanwir Zaman
 
Php cheat sheet
Piyush Mittal
 
python-cheat-sheet-v1
Hiroshi Ono
 
PHP Cheat Sheet
GlowTouch
 
Assignment 2 interview preparation work COSC1285
MadelineLong2
 
Expresiones Regulares
Juan Carlos Gonzales Vitte.
 
Programming data structure concept in array ppt
seetha394884
 
ANSI C REFERENCE CARD
Tia Ricci
 
Strings part2
yndaravind
 
Text Mining using Regular Expressions
Rupak Roy
 
Presentation on Data transformation in Stata.
anshukgec1599
 
Hybrid Atlas Models of Financial Equity Market
tomoyukiichiba
 
Module-2_Strings concepts in c programming
CHAITRAB29
 
Research Inventy : International Journal of Engineering and Science
researchinventy
 
STRING LIST TUPLE DICTIONARY FILE.pdf
omprakashmeena48
 
Unit3 jwfiles
mrecedu
 
C Language Unit-3
kasaragadda srinivasrao
 
2 homework
ジョ ビダル
 
Python lecture 05
Tanwir Zaman
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 

PHP Cheatsheet

  • 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 (pattern, 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) (lowercase L) 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 to 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{,6} Up to 6 of a S Ordinal Suffix (st, nd, rd, th) substr (string, start, len) a{3,6} 3 to 6 of a a{3,6}? 3 to 6 of a, ungreedy T Timezone of machine (GMT) Escape character Z Timezone offset (seconds) Filesystem Functions [:punct:] Any punctuation symbol O Difference to GMT (hours) (e.g., +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 2008-07-31T18:30:13+01:00 filesize (file) s Period matches newline r RFC 2822 file_exists (file) m ^ and $ match lines Thu, 31 Jul 2008 18:30:13 +0100 fopen (file, mode) U Ungreedy matching fread (handle, len) e Evaluate replacement 1. 0 is Sunday, 6 is Saturday. fwrite (handle, str) x Pattern over several lines readfile (file) 2. Week that overlaps two years belongs to year that contains most days of that Date and Time Functions week. Hence week number for 1st fopen() Modes checkdate (month, day, year) January of a given year can be 53 if r Read date (format, timestamp) week belongs to previous year. r+ Read and write, prepend getdate (timestamp) date("W", mktime(0, 0, 0, 12, 8, w Write, truncate mktime (hr, min, sec, month, day, yr) $year)) always gives correct number of w+ Read and write, truncate strftime (formatstring, timestamp) weeks in $year. a Write, append strtotime (str) a+ Read and write, append time () 3. The Epoch is the 1st January 1970. Available free from AddedBytes.com 4. With leading zeroes