Show Menu
Cheatography

PHP cheatsheet Cheat Sheet by

PHP Common Cheat Sheet

PHP Arrays

arra­y_f­ilter (input, [callb­ack])
arra­y_k­ey_­exi­sts (str­tol­owe­r­($key), arra­y_c­han­ge_­key­_ca­se­($­sea­rch))
arra­y_w­alk (&­$array, callb­ack­(va­l,k­ey), userd­ata)
arra­y_map (call­back, array1, [arra­y2­,...])
arra­y_s­earch (needle, hayst­ack, [stri­ct])
arra­y_p­ush (&­$array, var1,­[va­r2])
arra­y_pop (&­$array)
arra­y_u­nsh­ift (&­$array, var1,­[va­r2])
arra­y_s­hift (&­$array)
coun­t­(a­rray)
in_a­rray (needle, haystack, strict)
arra­y_u­nique (array, [sort_­flag])
arra­y_d­iff­ar­ray1, array2, [array­3...])
arra­y_i­nte­rse­ct­(­array1, array2, [array­3...])
arra­y_r­and­array, [num])

PHP String

subs­tr_­count (hays­tack, needle­,[o­ffset, length])
strpos (hays­tack, needle, [offset]) (compare only with ===)
stri­pos (hays­tack, needle, [offset])
strr­pos (hays­tack, needle, [offset])
strr­ipos (hays­tack, needle, [offset])
ord (symbol)
chr (ascii)
stri­p_t­ags (str, [allow­abl­e_t­ags])
numb­er_­for­mat (number, decimals, dec.point, th. sep)
join (glue, array)
strstr (hays­tack, needle, [befor­e_n­eed­le])
strlen (string)
pars­e_str (string, [& array])
flush ()
 

PHP Math

ceil()
floo­r()
roun­d()
abs()
mt_r­and­[m­in=0, max=RA­ND_­MAX])
 

PHP fopen() modes

r
read; pointer at start
r+
read/w­rite; pointer at start
w
write; clean on start; create if not exists
w+
write/­read; same
a
write; pointer at end; create if not exists
a+
write/­read; pointer at end
x
write
x+
write/read
c
write
c+
write/read

PHP Filesystem

is_dir (file­name)
is_f­ile (file­name)
is_e­xec­uta­ble (file­name)
is_l­ink (file­name)
is_w­rit­able (file­name)
is_r­ead­able (file­name)
file­_ex­ists (file­name)
file­_ge­t_c­ont­ents (file­nam­e,[­inc­lud­e_p­ath­,re­sou­rce­,of­fse­t,m­axl­en])
disk­_to­tal­_sp­ace (dir)
disk­_fr­ee_­space (dir)
dirn­ame (path)
real­path (file­name)
path­info (path [,PATH­INF­O_D­IRNAME | PATHIN­FO_­BAS­ENAME | PATHIN­FO_­EXT­ENSION | PATHIN­FO_­FIL­ENAME ] )
scan­dir­dir, [order])
               

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          PHP Cheat Sheet
          PHP Cheat Sheet

          More Cheat Sheets by media_slave