Buscar

krabat1 php

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 3, do total de 42 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 6, do total de 42 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes
Você viu 9, do total de 42 páginas

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Você também pode ser Premium ajudando estudantes

Prévia do material em texto

PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP TOC I
PHP Control Structures
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2456
PHP Function handling Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2462
PHP Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2474
PHP Logical Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2457
PHP Arithmetic Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2461
PHP Increm ​ent ​ing ​/De ​cre ​menting Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2458
PHP Bitwise Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2460
PHP Comparison Operators
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2459
PHP Math Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2447
PHP XML Manipu ​lation Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2448
PHP Network Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2440
PHP Error Handling Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2450
More PHP Cheat Sheet
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​sh
e ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2453
 
PHP Control Structures
if
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.i ​f.php
else
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.e ​lse.ph
p
else ​if/else if
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.e ​lse ​if.p
hp
Alte ​rnative syntax for control struct ​ures
http:/ ​/hu ​1.p ​hp.n ​et ​/ma ​nua ​l/e ​n/c ​ont ​rol ​-
st ​ruc ​tur ​es.a ​lt ​ern ​ati ​ve- ​syn ​tax.php
while
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.w ​hil ​e.p
hp
do-w ​hile
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.d ​o.w ​hil ​
e.php
for
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.f ​or.php
fore ​ach
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.f ​ore ​ach
.php
break
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.b ​rea ​k.p
hp
cont ​inue
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.c ​ont ​inu ​
e.php
switch
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.s ​wit ​ch.
php
decl ​are
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.d ​ecl ​are
.php
return
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/fu ​nct ​ion.re ​tur ​n.php
requ ​ire
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/fu ​nct ​ion.re ​qui ​re.php
incl ​ude
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/fu ​nct ​ion.in ​clu ​de.php
 
PHP Control Structures (cont)
requ ​ire ​_once
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/fu ​nct ​ion.re ​qui ​re- ​onc ​e.php
incl ​ude ​_once
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/fu ​nct ​ion.in ​clu ​de- ​onc ​e.php
goto
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/co ​ntr ​ol- ​str ​uct ​ure ​s.g ​oto.ph
p
PHP Function handling Functions
call ​_us ​er_ ​fun ​c_a ​rra ​y()
Call a callback with an array of parame ​ters
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
call ​_us ​er_ ​fun ​c()
Call the callback given by the first parameter
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
crea ​te_ ​fun ​cti ​on()
Create an anonymous (lambd ​a-s ​tyle) function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
forw ​ard ​_st ​ati ​c_c ​all ​_ar ​ray()
Call a static method and pass the arguments
as array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
forw ​ard ​_st ​ati ​c_c ​all()
Call a static method
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
func ​_ge ​t_a ​rg()
Return an item from the argument list
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
func ​_ge ​t_a ​rgs()
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 1 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Function handling Functions (cont)
Returns an array comprising a function's
argument list
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
func ​_nu ​m_a ​rgs()
Returns the number of arguments passed to the
function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
func ​tio ​n_e ​xis ​ts()
Return TRUE if the given function has been
defined
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
get_ ​def ​ine ​d_f ​unc ​tio ​ns()
Returns an array of all defined functions
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
regi ​ste ​r_s ​hut ​dow ​n_f ​unc ​tio ​n()
Register a function for execution on shutdown
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
regi ​ste ​r_t ​ick ​_fu ​nct ​ion()
Register a function for execution on each tick
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
unre ​gis ​ter ​_ti ​ck_ ​fun ​cti ​on()
*De-re ​gister a function for execution on each
tick
example
PHP Operators
■ Operat ​ors
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/la ​ngu ​age.op ​era ​tor ​s.php
■ What does this symbol mean in PHP?
http:/ ​/st ​ack ​ove ​rfl ​ow.c ​om ​/qu ​est ​ion ​s/3 ​737 ​139 ​/re ​fer ​e
nc ​e-w ​hat ​-do ​es- ​thi ​s-s ​ymb ​ol- ​mea ​n-i ​n-php
 
PHP Logical Operators
Exam ​
ple
Name Result
$a
and
$b
And TRUE if both $a and $b are
TRUE.
$a or
$b
Or TRUE if either $a or $b is
TRUE.
$a xor
$b
Xor TRUE if either $a or $b is
TRUE, but not both.
! $a Not TRUE if $a is not TRUE.
$a &&
$b
And TRUE if both $a and $b are
TRUE.
$a ||
$b
Or TRUE if either $a or $b is
TRUE.
PHP Arithmetic Operators
Exam ​p
le
Name Result
-$a Negation Opposite of $a.
$a +
$b
Addition Sum of $a and $b.
$a - $b Subtra ​ctio
n
Difference of $a and $b.
$a * $b Multip ​lic ​at
ion
Product of $a and $b.
$a / $b Division Quotient of $a and $b.
$a %
$b
Modulus Remainder of $a divided
by $b.
PHP Increm ​ent ​ing ​/De ​cre ​menting Operators
Exam ​
ple
Name Effect
++$a Pre-
in ​crement
Increments $a by one,
then returns $a.
$a++ Post-
i ​ncr ​ement
Returns $a, then
increments $a by one.
--$a Pre-
de ​cremen
t
Decrements $a by one,
then returns $a.
$a-- Post-
d ​ecr ​emen
t
Returns $a, then
decrements $a by one.
 
PHP Bitwise Operators
Exam ​
ple
Name Result
$a &
$b
And Bits that are set in both
$a and $b are set.
$a |
$b
Or
(inclusive
or)
Bits that are set in either
$a or $b are set.
$a ^
$b
Xor
(exclusive
or)
Bits that are set in $a or
$b but not both are set.
~ $a Not Bits that are set in $a are
not set, and vice versa.
$a <<
$b
Shift left Shift the bits of $a $b
steps to the left(each
step means " ​mul ​tiply by
two")
$a >>
$b
Shift right Shift the bits of $a $b
steps to the right (each
step means " ​divide by
two")
PHP Comparison Operators
Exam ​
ple
Name Result
$a ==
$b
Equal TRUE if $a is equal to $b
after type juggling.
$a
===
$b
Identical TRUE if $a is equal to $b,
and they are of the same
type.
$a !=
$b
Not
equal
TRUE if $a is not equal to
$b after type juggling.
$a <>
$b
Not
equal
TRUE if $a is not equal to
$b after type juggling.
$a
!==
$b
Not
identical
TRUE if $a is not equal to
$b, or they are not of the
same type.
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 2 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Comparison Operators (cont)
$a < $b Less
than
TRUE if $a is strictly
less than $b.
$a > $b Greater
than
TRUE if $a is strictly
greater than $b.
$a <= $b Less
than or
equal to
TRUE if $a is less than
or equal to $b.
$a >= $b Greater
than or
equal to
TRUE if $a is greater
than or equal to $b.
Comp ​ari
son
with Various Types
Type of
Operand
1
Type of
Operand
2
Result
null or
string
string Convert NULL to " ​",
numerical or lexical
comparison
bool or
null
anything Convert to bool,
FALSE < TRUE
object object Built-in classes can
define its own
compar ​ison, different
classes are
uncomp ​arable, same
class - compare
properties the same
way as arrays (PHP 4),
PHP 5 has its own
explan ​ation
string,
resource
or
number
string,
resource
or
number
Translate strings and
resources to numbers,
usual math
 
PHP Comparison Operators (cont)
array array Array with fewer members
is smaller, if key from
operand 1 is not found in
operand 2 then arrays are
uncomp ​arable, otherwise -
compare value by value
(see following example)
array anything array is always greater
object anything object is always greater
PHP Math Functions
abs()
Absolute value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
acos()
Arc cosine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
acos ​h()
Inverse hyperbolic cosine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
asin()
Arc sine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
asin ​h()
Inverse hyperbolic sine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
 
PHP Math Functions (cont)
atan ​2()
Arc tangent of two variables
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
atan()
Arc tangent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
atan ​h()
Inverse hyperbolic tangent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
base ​_co ​nve ​rt()
Convert a number between arbitrary bases
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
bind ​ec()
Binary to decimal
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ceil()
Round fractions up
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
cos()
Cosine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
cosh()
Hyper ​bolic cosine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
decb ​in()
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 3 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Math Functions (cont)
Decimal to binary
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
dech ​ex()
Decimal to hexade ​cimal
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
deco ​ct()
Decimal to octal
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
deg2 ​rad()
Converts the number in degrees to the radian
equiva ​lent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
exp()
Calcu ​lates the exponent of e
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
expm ​1()
Returns exp(nu ​mber) - 1, computed in a way
that is accurate even when the value of number
is close to zero
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
floo ​r()
Round fractions down
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
fmod()
Returns the floating point remainder (modulo)
of the division of the arguments
example
 
PHP Math Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
getr ​and ​max()
Show largest possible random value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
hexd ​ec()
Hexad ​ecimal to decimal
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
hypo ​t()
Calculate the length of the hypotenuse of a
right- ​angle triangle
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
is_f ​ini ​te()
Finds whether a value is a legal finite number
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
is_i ​nfi ​nit ​e()
Finds whether a value is infinite
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
is_n ​an()
Finds whether a value is not a number
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
lcg_ ​val ​ue()
Combined linear congru ​ential generator
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
log1 ​0()
Base-10 logarithm
example
 
PHP Math Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
log1 ​p()
Returns log(1 + number), computed in a way
that is accurate even when the value of number
is close to zero
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
log()
Natural logarithm
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
max()
Find highest value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
min()
Find lowest value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
mt_g ​etr ​and ​max()
Show largest possible random value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
mt_r ​and()
Generate a better random value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
mt_s ​ran ​d()
Seed the better random number generator
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
octd ​ec()
Octal to decimal
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 4 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Math Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
pi()
Get value of pi
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
pow()
Expon ​ential expres ​sion
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--rad2 ​deg()
Converts the radian number to the equivalent
number in degrees
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rand()
Generate a random integer
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
roun ​d()
Rounds a float
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sin()
Sine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sinh()
Hyper ​bolic sine
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sqrt()
Square root
 
PHP Math Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sran ​d()
Seed the random number generator
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
tan()
Tangent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
tanh()
Hyper ​bolic tangent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
PHP XML Manipu ​lation Functions
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DOM
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
dom_ ​imp ​ort ​_si ​mpl ​exm ​l()
Gets a DOMElement object from a
Simple ​XML ​Element object
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DOM CONSTA ​NTS
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/do ​m.c ​ons ​tan ​ts.php
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LIBXML
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​cle ​ar_ ​err ​ors()
Clear libxml error buffer
 
PHP XML Manipu ​lation Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​dis ​abl ​e_e ​nti ​ty_ ​loa ​der()
Disable the ability to load external entities
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​get ​_er ​ror ​s()
Retrieve array of errors
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​get ​_la ​st_ ​err ​or()
Retrieve last error from libxml
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​set ​_ex ​ter ​nal ​_en ​tit ​y_l ​oad ​er()
Changes the default external entity loader
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​set ​_st ​rea ​ms_ ​con ​tex ​t()
Set the streams context for the next libxml
document load or write
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
libx ​ml_ ​use ​_in ​ter ​nal ​_er ​ror ​s()
Disable libxml errors and allow user to fetch
error inform ​ation as needed
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LIBXML CONSTA ​NTS
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/li ​bxm ​l.c ​ons ​tan ​ts.php
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 5 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP XML Manipu ​lation Functions (cont)
SIMP ​LEXML
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
simp ​lex ​ml_ ​imp ​ort ​_do ​m()
Get a Simple ​XML ​Element object from a DOM
node.
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
simp ​lex ​ml_ ​loa ​d_f ​ile()
Inter ​prets an XML file into an object
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
simp ​lex ​ml_ ​loa ​d_s ​tri ​ng()
Inter ​prets a string of XML into an object
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
XML PARSER
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
utf8 ​_de ​cod ​e()
Converts a string with ISO-8859-1 characters
encoded with UTF-8 to single ​-byte ISO-88 ​59-1
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
utf8 ​_en ​cod ​e()
Encodes an ISO-8859-1 string to UTF-8
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​err ​or_ ​str ​ing()
Get XML parser error string
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​get ​_cu ​rre ​nt_ ​byt ​e_i ​nde ​x()
Get current byte index for an XML parser
 
PHP XML Manipu ​lation Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​get ​_cu ​rre ​nt_ ​col ​umn ​_nu ​mbe ​r()
Get current column number for an XML parser
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​get ​_cu ​rre ​nt_ ​lin ​e_n ​umb ​er()
Get current line number for an XML parser
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​get ​_er ​ror ​_co ​de()
Get XML parser error code
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​se_ ​int ​o_s ​tru ​ct()
Parse XML data into an array structure
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​se()
Start parsing an XML document
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​ser ​_cr ​eat ​e_n ​s()
Create an XML parser with namespace support
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​ser ​_cr ​eat ​e()
Create an XML parser
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​ser ​_fr ​ee()
Free an XML parser
example
 
PHP XML Manipu ​lation Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​ser ​_ge ​t_o ​pti ​on()
Get options from an XML parser
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​par ​ser ​_se ​t_o ​pti ​on()
Set options in an XML parser
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_ch ​ara ​cte ​r_d ​ata ​_ha ​ndl ​er()
Set up character data handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_de ​fau ​lt_ ​han ​dle ​r()
Set up default handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_el ​eme ​nt_ ​han ​dle ​r()
Set up start and end element handlers
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_en ​d_n ​ame ​spa ​ce_ ​dec ​l_h ​and ​ler()
Set up end namespace declar ​ation handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_ex ​ter ​nal ​_en ​tit ​y_r ​ef_ ​han ​dle ​r()
Set up external entity reference handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_no ​tat ​ion ​_de ​cl_ ​han ​dle ​r()
Set up notation declar ​ation handler
example
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 6 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP XML Manipu ​lation Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​--​- ​- ​-- ​​--- ​--
xml_ ​set ​_ob ​jec ​t()
Use XML Parser within an object
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_pr ​oce ​ssi ​ng_ ​ins ​tru ​cti ​on_ ​han ​dle ​r()
Set up processing instru ​ction (PI) handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_st ​art ​_na ​mes ​pac ​e_d ​ecl ​_ha ​ndl ​er()
Set up start namespace declar ​ation handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
xml_ ​set ​_un ​par ​sed ​_en ​tit ​y_d ​ecl ​_ha ​ndl ​er()
*Set up unparsed entity declar ​ation handler
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
XML PARSER CONSTANTS
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
XML_ ​ERR ​OR_ ​NONE (integer)
XML_ ​ERR ​OR_ ​NO_ ​MEM ​ORY (integer)
XML_ ​ERR ​OR_ ​SYN ​TAX (integer)
XML_ ​ERR ​OR_ ​NO_ ​ELE ​MENTS (integer)
XML_ ​ERR ​OR_ ​INV ​ALI ​D_T ​OKEN (integer)
XML_ ​ERR ​OR_ ​UNC ​LOS ​ED_ ​TOKEN (integer)
XML_ ​ERR ​OR_ ​PAR ​TIA ​L_C ​HAR (integer)
XML_ ​ERR ​OR_ ​TAG ​_MI ​SMA ​TCH (integer)
XML_ ​ERR ​OR_ ​DUP ​LIC ​ATE ​_AT ​TRI ​BUTE
(integer)
XML_ ​ERR ​OR_ ​JUN ​K_A ​FTE ​R_D ​OC_ ​ELE ​MEN
T (integer)
XML_ ​ERR ​OR_ ​PAR ​AM_ ​ENT ​ITY ​_REF
(integer)
XML_ ​ERR ​OR_ ​UND ​EFI ​NED ​_EN ​TITY (integer)
XML_ ​ERR ​OR_ ​REC ​URS ​IVE ​_EN ​TIT ​Y_REF
(integer)
XML_ ​ERR ​OR_ ​ASY ​NC_ ​ENT ​ITY (integer)
 
PHP XML Manipu ​lation Functions (cont)
XML_ ​ERR ​OR_ ​BAD ​_CH ​AR_ ​REF (integer)
XML_ ​ERR ​OR_ ​BIN ​ARY ​_EN ​TIT ​Y_REF
(integer)
XML_ ​ERR ​OR_ ​ATT ​RIB ​UTE ​_EX ​TER ​NAL ​_EN ​T
IT ​Y_REF (integer)
XML_ ​ERR ​OR_ ​MIS ​PLA ​CED ​_XM ​L_PI
(integer)
XML_ ​ERR ​OR_ ​UNK ​NOW ​N_E ​NCO ​DING
(integer)
XML_ ​ERR ​OR_ ​INC ​ORR ​ECT ​_EN ​COD ​ING
(integer)
XML_ ​ERR ​OR_ ​UNC ​LOS ​ED_ ​CDA ​TA_ ​SEC ​TIO
N (integer)
XML_ ​ERR ​OR_ ​EXT ​ERN ​AL_ ​ENT ​ITY ​_HA ​NDL ​I
NG (integer)
XML_ ​OPT ​ION ​_CA ​SE_ ​FOL ​DING (integer)
XML_ ​OPT ​ION ​_TA ​RGE ​T_E ​NCO ​DING
(integer)
XML_ ​OPT ​ION ​_SK ​IP_ ​TAG ​START (integer)
XML_ ​OPT ​ION ​_SK ​IP_ ​WHITE (integer)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
XML_ ​SAX ​_IMPL (string)
Holds the SAX implem ​ent ​ation method. Can be
libxml or expat.
PHP Network Functions
chec ​kdn ​srr()
Check DNS records corres ​ponding to a given
Internet host name or IP address
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
clos ​elo ​g()
Close connection to system logger
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
defi ​ne_ ​sys ​log ​_va ​ria ​ble ​s()
Initi ​alizes all syslog related variables
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
dns_ ​che ​ck_ ​rec ​ord()
Alias of checkd ​nsrr
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
dns_ ​get ​_mx()
Alias of getmxrr
 
PHP Network Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
dns_ ​get ​_re ​cor ​d()
Fetch DNS Resource Records associated with
a hostname
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
fsoc ​kop ​en()
Open Internet or Unix domain socket
connec ​tion
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
geth ​ost ​bya ​ddr()
Get the Internet host name corres ​ponding to a
given IP address
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
geth ​ost ​byn ​ame()
Get the IPv4 address corres ​ponding to a given
Internet host name
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
geth ​ost ​byn ​ame ​l()
Get a list of IPv4 addresses corres ​ponding to a
given Internet host name
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
geth ​ost ​nam ​e()
Gets the host name
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
getm ​xrr()
Get MX records corres ​ponding to a given
Internet host name
example
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 7 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Network Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
getp ​rot ​oby ​nam ​e()
Get protocol number associated with protocol
name
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
getp ​rot ​oby ​num ​ber()
Get protocol name associated with protocol
number
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
gets ​erv ​byn ​ame()
Get port number associated with an Internet
service and protocol
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
gets ​erv ​byp ​ort()
Get Internet service which corres ​ponds to port
and protocol
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
head ​er_ ​reg ​ist ​er_ ​cal ​lba ​ck()
Call a header function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
head ​er_ ​rem ​ove()
Remove previously set headers
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
head ​er()
Send a raw HTTP header
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
head ​ers ​_li ​st()
 
PHP Network Functions (cont)
Returns a list of response headers sent (or
ready to send)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
head ​ers ​_se ​nt()
Checks if or where headers have been sent
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
http ​_re ​spo ​nse ​_co ​de()
Get or Set the HTTP response code
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
inet ​_nt ​op()
Converts a packed internet address to a
human readable repres ​ent ​ation
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
inet ​_pt ​on()
Converts a human readable IP address to its
packed in_addr repres ​ent ​ation
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ip2l ​ong()
Converts a string containing an (IPv4) Internet
Protocol dotted address into a proper address
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
long ​2ip()
Converts an (IPv4) Internet network address
into a string in Internet standard dotted format
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
open ​log()
Open connection to system logger
 
PHP Network Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
pfso ​cko ​pen()
Open persistent Internet or Unix domain socket
connec ​tion
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
setc ​ook ​ie()
Send a cookie
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
setr ​awc ​ook ​ie()
Send a cookie without urlenc ​oding the cookie
value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sock ​et_ ​get ​_st ​atu ​s()
Alias of stream ​_ge ​t_m ​eta ​_data
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sock ​et_ ​set ​_bl ​ock ​ing()
Alias of stream ​_se ​t_b ​loc ​king
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sock ​et_ ​set ​_ti ​meo ​ut()
Aliasof stream ​_se ​t_t ​imeout
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sysl ​og()
Generate a system log message
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 8 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Network Functions (cont)
NETWORK CONSTANTS
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
*open ​log() Options
LOG_ ​CON ​S()
if there is an error while sending data to the
system logger, write directly to the system
console
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​NDE ​LAY()
open the connection to the logger immedi ​ately
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​ODE ​LAY()
(default) delay opening the connection until the
first message is logged
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​NOW ​AIT()
**
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​PER ​ROR()
print log message also to standard error
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​PID()
include PID with each message
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
*open ​log() Facili ​ties
LOG_ ​AUT ​H()
securi ​ty/ ​aut ​hor ​ization messages (use
LOG_AU ​THPRIV instead in systems where that
constant is defined)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​AUT ​HPR ​IV()
secur ​ity ​/au ​tho ​riz ​ation messages (private)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​CRO ​N()
 
PHP Network Functions (cont)
clock daemon (cron and at)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​DAE ​MON()
other system daemons
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​KER ​N()
kernel messages
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​LOCAL0 ... LOG_LO ​CAL ​7()
reserved for local use, these are not available
in Windows
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​LPR()
line printer subsystem
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​MAI ​L()
mail subsystem
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​NEW ​S()
USENET news subsystem
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​SYS ​LOG()
messages generated internally by syslogd
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​USE ​R()
generic user-level messages
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​UUC ​P()
UUCP subsystem
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
*syslog() Priorities (in descending order)
 
PHP Network Functions (cont)
LOG_ ​EME ​RG()
system is unusable
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​ALE ​RT()
action must be taken immedi ​ately
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​CRI ​T()
critical condit ​ions
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​ERR()
error condit ​ions
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​WAR ​NIN ​G()
warning condit ​ions
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​NOT ​ICE()
normal, but signif ​icant, condition
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​INF ​O()
infor ​mat ​ional message
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
LOG_ ​DEB ​UG()
debug ​-level message
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
*dns_ ​get ​_re ​cord() Options
DNS_ ​A()
IPv4 Address Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​MX()
Mail Exchanger Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 9 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Network Functions (cont)
DNS_ ​CNA ​ME()
Alias (Canonical Name) Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​NS()
Autho ​rit ​ative Name Server Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​PTR()
Pointer Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​HIN ​FO()
Host Info Resource (See IANA's » Operating
System Names for the meaning of these
values)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​SOA()
Start of Authority Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​TXT()
Text Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​ANY()
Any Resource Record. On most systems this
returns all resource records, however it should
not be counted upon for critical uses. Try
DNS_ALL instead.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​AAA ​A()
IPv6 Address Resource
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
DNS_ ​ALL()
*Itera ​tively query the name server for each
available record type.
 
PHP Error Handling Functions
■ List of Parser Tokens:
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/to ​ken ​s.php
Various parts of the PHP language are
repres ​ented internally by types like T_SR. PHP
outputs identi ​fiers like this one in parse errors,
like " ​Parse error: unexpected T_SR,
expecting ',' or ';' in script.php on line 10."
You're supposed to know what T_SR means.
For everybody who doesn't know that, here is a
table with those identi ​fiers, PHP-syntax and
references to the approp ​riate places in the
manual.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
debu ​g_b ​ack ​tra ​ce()
Generates a backtrace
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
debu ​g_p ​rin ​t_b ​ack ​tra ​ce()
Prints a backtrace
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
erro ​r_g ​et_ ​las ​t()
Get the last occurred error
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
erro ​r_l ​og()
Send an error message somewhere
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
erro ​r_r ​epo ​rti ​ng()
Sets which PHP errors are reported
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rest ​ore ​_er ​ror ​_ha ​ndl ​er()
Restores the previous error handler function
example
 
PHP Error Handling Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rest ​ore ​_ex ​cep ​tio ​n_h ​and ​ler()
Restores the previously defined exception
handler function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
set_ ​err ​or_ ​han ​dle ​r()
Sets a user-d ​efined error handler function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
set_ ​exc ​ept ​ion ​_ha ​ndl ​er()
Sets a user-d ​efined exceptionhandler function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
trig ​ger ​_er ​ror()
Generates a user-level error/ ​war ​nin ​g/n ​otice
message
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
user ​_er ​ror()
*Alias of trigge ​r_error
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ERROR HANDLING CONSTA ​NTS
http:/ ​/hu ​2.p ​hp.n ​et ​/ma ​nua ​l/e ​n/e ​rro ​rfu ​nc.c ​on ​sta ​nts.p
hp
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 10 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
More PHP Cheat Sheet
http:/ ​/ov ​era ​pi.c ​om ​/php/
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/da ​vec ​hil ​d/c ​hea ​t-
s ​hee ​ts/php/
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/gu ​slo ​ng/ ​che ​at- ​she ​et
s ​/ph ​p-s ​ynt ​ax- ​for ​-be ​gin ​ners/
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/mk ​pea ​coc ​k/c ​hea ​t-
s ​hee ​ts/ ​php ​-fu ​nda ​men ​tals/
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/me ​dia ​-
sl ​ave ​/ch ​eat ​-sh ​eet ​s/p ​hp- ​che ​ats ​heet/
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.d ​rea ​min ​cod ​e.n ​et/ ​dow ​nlo ​ads ​/re ​f_s ​hee ​ts
/ ​php ​_re ​fer ​enc ​e_s ​hee ​t.pdf
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.d ​igi ​lif ​e.b ​e/q ​uic ​kre ​fer ​enc ​es/ ​QRC ​/PH ​P
%2 ​0Ch ​eat ​%20 ​She ​et.pdf
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.s ​k89 ​q.c ​om/ ​con ​ten ​t/2 ​010 ​/04 ​/ph ​pse ​c_c ​h
ea ​tsh ​eet.pdf
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/i.e ​me ​zet ​a.c ​om/ ​web ​log ​/em ​eze ​ta- ​php ​-
ca ​rd- ​v0.2.png
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.d ​umm ​ies.co ​m/h ​ow- ​to/ ​con ​ten ​t/p ​hp- ​my
s ​ql- ​for ​-du ​mmi ​es- ​che ​at- ​she ​et.html (PHP +
MySQL)
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/op ​end ​ir.h ​u/ ​tmp ​/pu ​b/f ​ile ​s/c ​hea ​tsh ​eet ​/ph ​p_m ​ys
q ​l/p ​hp_ ​mys ​ql_ ​che ​ats ​hee ​t.png (PHP + MySQL)
 
More PHP Cheat Sheet (cont)
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/op ​end ​ir.h ​u/ ​tmp ​/pu ​b/f ​ile ​s/c ​hea ​tsh ​eet ​/ar ​ray ​_st ​
rin ​g_p ​hp_ ​che ​ats ​hee ​t.png
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.d ​igi ​lif ​e.b ​e/q ​uic ​kre ​fer ​enc ​es/ ​QRC ​/PH ​P
%2 ​04% ​20R ​efe ​ren ​ce% ​20C ​ard.pdf
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ww ​w.v ​isi ​bon ​e.c ​om/ ​php ​/ph ​psk ​inn ​ysh ​eet ​bac ​k
.gif
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/ro ​sha ​nbh.co ​m.n ​p/2 ​008 ​/05 ​/us ​efu ​l-
s ​erv ​er- ​var ​iab ​les ​-ph ​p.html
------ ​​​- ​- ​- ​​- ​​-- ​​​-- ​- ​​​-- ​​- ​- ​​-- ​​​- ​-- ​​​-- ​​- ​​- ​- ​- ​​​--- ​--
http:/ ​/we ​bch ​eat ​she ​et.c ​om ​/ph ​p/r ​egu ​lar ​_ex ​pre ​ssi ​on
s.php (PHP + REGEX)
PHP TOC II
PHP Predefined Variables
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​s
he ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2455
PHP Array Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​s
he ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2435
PHP String Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​s
he ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2436
PHP Date/Time Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​s
he ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2437
PHP Calendar Functions
http:/ ​/ww ​w.c ​hea ​tog ​rap ​hy.c ​om ​/kr ​aba ​t1/ ​che ​at- ​s
he ​ets ​/ph ​p/# ​tit ​le_ ​706 ​_2438
Code Vault
Many thx for the Code Vault!
http:/ ​/cdv.lt
Chrome Extens ​ion:
https: ​//c ​hro ​me.g ​oo ​gle.co ​m/w ​ebs ​tor ​e/d ​eta ​il/ ​jlk ​bbp ​
mih ​beh ​jca ​bec ​bkn ​mdd ​mkn ​conbf
 
PHP Predefined Variables
Supe ​rgl ​obals
Super ​globals are built-in variables that are
always available in all scopes
Several predefined variables in PHP are
" ​sup ​erg ​lob ​als ​", which means they are available
in all scopes throughout a script. There is no
need to do global $variable; to access them
within functions or methods.
These superg ​lobal variables are:
$GLO ​BALS
$_SE ​RVER
$_GET
$_POST
$_FI ​LES
$_CO ​OKIE
$_SE ​SSION
$_RE ​QUEST
$_ENV
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$GLO ​BALS
Refer ​ences all variables available in global
scope
An associ ​ative array containing references to
all variables which are currently defined in the
global scope of the script. The variable names
are the keys of the array.
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVER
Server and execution enviro ​nment inform ​ation
■ 8 useful server variables available in
PHP: http:/ ​/cd ​v.lt/Hs
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PHP ​_SE ​LF']
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 11 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Predefined Variables (cont)
The filename of the currently executing script,
relative to the document root. For instance,
$_SERV ​ER[ ​'PH ​P_S ​ELF'] in a script at the
address http:/ ​/ex ​amp ​le.c ​om ​/te ​st.p ​hp ​/fo ​o.bar
would be /test.p ​hp ​/fo ​o.bar. The __FILE__
constant contains the full path and filename of
the current (i.e. included) file. If PHP is running
as a comman ​d-line processor this variable
contains the script name since PHP 4.3.0.
Previously it was not available.
'argv'
Array of arguments passed to the script. When
the script is run on the command line, this gives
C-style access to the command line
parame ​ters. When called via the GET method,
this will contain the query string.
'argc'
Contains the number of command line
parameters passed to the script (if run on the
command line).
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​GAT ​EWA ​Y_I ​NTE ​RFA ​CE']
What revision of the CGI specif ​ication the
server is using; i.e. 'CGI/1.1'.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_AD ​DR']
The IP address of the server under which the
current script is execut ​ing.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER​_NA ​ME']
The name of the server host under which the
current script is executing. If the script is
running on a virtual host, this will be the value
defined for that virtual host.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_SO ​FTW ​ARE']
Server identi ​fic ​ation string, given in the headers
when responding to requests.
 
PHP Predefined Variables (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_PR ​OTO ​COL']
Name and revision of the inform ​ation protocol
via which the page was requested; i.e.
'HTTP/ ​1.0';
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REQ ​UES ​T_M ​ETH ​OD']
Which request method was used to access the
page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
Note:
PHP script is terminated after sending headers
(it means after producing any output without
output buffering) if the request method was
HEAD.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REQ ​UES ​T_T ​IME']
The timestamp of the start of the request.
Available since PHP 5.1.0.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REQ ​UES ​T_T ​IME ​_FL ​OAT']
The timestamp of the start of the request, with
micros ​econd precision. Available since PHP
5.4.0.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​QUE ​RY_ ​STR ​ING']
The query string, if any, via which the page was
accessed.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​DOC ​UME ​NT_ ​ROO ​T']
The document root directory under which the
current script is executing, as defined in the
server's config ​uration file.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_A ​CCE ​PT']
Contents of the Accept: header from the current
request, if there is one.
 
PHP Predefined Variables (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_A ​CCE ​PT_ ​CHA ​RSE ​T']
Contents of the Accept ​-Ch ​arset: header from
the current request, if there is one. Example:
'iso-8 ​859 ​-1, ​,u ​tf-8'.*
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_A ​CCE ​PT_ ​ENC ​ODI ​NG']
Contents of the Accept ​-En ​coding: header from
the current request, if there is one. Example:
'gzip'.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_A ​CCE ​PT_ ​LAN ​GUA ​GE']
Contents of the Accept ​-La ​nguage: header from
the current request, if there is one. Example:
'en'.
■ Detect Browser Language in PHP:
http:/ ​/cd ​v.lt/I5
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_C ​ONN ​ECT ​ION']
Contents of the Connec ​tion: header from the
current request, if there is one. Example:
'Keep- ​Ali ​ve'.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_H ​OST']
Contents of the Host: header from the current
request, if there is one.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_R ​EFE ​RER']
The address of the page (if any) which referred
the user agent to the current page. This is set
by the user agent. Not all user agents will set
this, and some provide the ability to modify
HTTP_R ​EFERER as a feature. In short, it
cannot really be trusted.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​P_U ​SER ​_AG ​ENT']
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 12 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Predefined Variables (cont)
Contents of the User-A ​gent: header from the
current request, if there is one. This is a string
denoting the user agent being which is
accessing the page. A typical example is:
Mozill ​a/4.5 [en] (X11; U; Linux 2.2.9 i586).
Among other things, you can use this value with
get_br ​owser() to tailor your page's output to the
capabi ​lities of the user agent.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​HTT ​PS']
Set to a non-empty value if the script was
queried through the HTTPS protocol.
Note: Note that when using ISAPI with IIS, the
value will be off if the request was not made
through the HTTPS protocol.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REM ​OTE ​_AD ​DR']
The IP address from which the user is viewing
the current page.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REM ​OTE ​_HO ​ST']
The Host name from which the user is viewing
the current page. The reverse dns lookup is
based off the REMOTE ​_ADDR of the user.
Note: Your web server must be configured to
create this variable. For example in Apache
you'll need Hostna ​meL ​ookups On inside
httpd.conf for it to exist. See also
gethos ​tby ​addr().
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REM ​OTE ​_PO ​RT']
The port being used on the user's machine to
commun ​icate with the web server.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REM ​OTE ​_US ​ER']
The authen ​ticated user.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
 
PHP Predefined Variables (cont)
$_SE ​RVE ​R[' ​RED ​IRE ​CT_ ​REM ​OTE ​_US ​ER']
The authen ​ticated user if the request is
internally redire ​cted.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SCR ​IPT ​_FI ​LEN ​AME']
The absolute pathname of the currently
executing script.
Note:
If a script is executed with the CLI, as a relative
path, such as file.php or ../fil ​e.php,
$_SERV ​ER[ ​'SC ​RIP ​T_F ​ILE ​NAME'] will contain
the relative path specified by the user.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_AD ​MIN']
The value given to the SERVER ​_ADMIN (for
Apache) directive in the web server
config ​uration file. If the script is running on a
virtual host, this will be the value defined for
that virtual host.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_PO ​RT']
The port on the server machine being used by
the web server for commun ​ica ​tion. For default
setups, this will be '80'; using SSL, for instance,
will change this to whatever your defined
secure HTTP port is.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SER ​VER ​_SI ​GNA ​TUR ​E']
String containing the server version and virtual
host name which are added to server ​-
ge ​nerated pages, if enabled.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PAT ​H_T ​RAN ​SLA ​TED']
Files ​ystem- (not document root-) based path to
the current script, after the server has done any
virtua ​l-t ​o-real mapping.
 
PHP Predefined Variables (cont)
Note: As of PHP 4.3.2, PATH_T ​RAN ​SLATED
is no longer set implicitly under the Apache 2
SAPI in contrast to the situation in Apache 1,
where it's set to the same value as the
SCRIPT ​_FI ​LENAME server variable when it's
not populated by Apache. This change was
made to comply with the CGI specif ​ication that
PATH_T ​RAN ​SLATED should only exist if
PATH_INFO is defined. Apache 2 users may
use Accept ​Pat ​hInfo = On inside httpd.conf to
define PATH_INFO.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​--​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​SCR ​IPT ​_NA ​ME']
Contains the current script's path. This is useful
for pages which need to point to themse ​lves.
The __FILE__ constant contains the full path
and filename of the current (i.e. included) file.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​REQ ​UES ​T_U ​RI']
The URI which was given in order to access
this page; for instance, '/inde ​x.h ​tml'.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PHP ​_AU ​TH_ ​DIG ​EST']
When doing Digest HTTP authen ​tic ​ation this
variable is set to the 'Autho ​riz ​ation' header sent
by the client (which you should then use to
make the approp ​riate valida ​tion).
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PHP ​_AU ​TH_ ​USE ​R']
When doing HTTP authen ​tic ​ation this variable
is set to the username provided by the user.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PHP ​_AU ​TH_ ​PW']
When doing HTTP authen ​tic ​ation this variable
is set to the password provided by the user.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​AUT ​H_T ​YPE']
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 13 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Predefined Variables (cont)
When doing HTTP authen ​ticated this variable is
set to the authen ​tic ​ation type.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​PAT ​H_I ​NFO']
Contains any client ​-pr ​ovided pathname
inform ​ation trailing the actual script filename but
preceding the query string, if available. For
instance, if the current script was accessed via
the URL
http:/ ​/ww ​w.e ​xam ​ple.co ​m/p ​hp/ ​pat ​h_i ​nfo.ph ​p/s ​ome ​/
st ​uff ​?fo ​o=bar, then
$_SERV ​ER[ ​'PA ​TH_ ​INFO'] would contain
/some/ ​stuff.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​RVE ​R[' ​ORI ​G_P ​ATH ​_IN ​FO']
Original version of 'PATH_ ​INFO' before
processed by PHP.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_GET
HTTP GET variables
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_POST
HTTP POST variables
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_FI ​LES
HTTP File Upload variables
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_RE ​QUEST
HTTP Request variables
 
PHP Predefined Variables (cont)
An associ ​ative array that by default contains
the contents of $_GET, $_POST and
$_COOKIE.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_SE ​SSION
Session variables
An associ ​ative array containing session
variables available to the current script. See the
Session functions docume ​ntation for more
inform ​ation on how this is used.
Session functions:
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/re ​f.s ​ess ​ion.php
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_ENV
Envir ​onment variables
An associ ​ative array of variables passed to the
current script via the enviro ​nment method.
These variables are imported into PHP's global
namespace from the enviro ​nment under which
the PHP parser is running. Many are provided
by the shell under which PHP is running and
different systems are likely running different
kinds of shells, a definitive list is imposs ​ible.
Please see your shell's docume ​ntation for a list
of defined enviro ​nment variables.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$_CO ​OKIE
HTTP Cookies
An associ ​ative array of variables passed to the
current script via HTTP Cookies.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
 
PHP Predefined Variables (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$php ​_er ​ror ​msg
*The previous error message
$php_e ​rrormsg is a variable containing the text
of the last error message generated by PHP.
This variable will only be available within the
scope in which the error occurred, and only if
the track_ ​errors config ​uration option is turned
on (it defaults to off).*
Note: This variable is only available when
track_ ​errors is enabled in php.ini.
Warning: If a user defined error handler (
set_er ​ror ​_ha ​ndl ​er()) is set $php_e ​rrormsg is
only set if the error handler returns FALSE.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$HTT ​P_R ​AW_ ​POS ​T_D ​ATA
Raw POST data
$HTTP_ ​RAW ​_PO ​ST_DATA contains the raw
POST data.
See always ​_po ​pul ​ate ​_ra ​w_p ​ost ​_data
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/in ​i.c ​ore.ph ​p#i ​ni.a ​lw ​ays ​-
po ​pul ​ate ​-ra ​w-p ​ost ​-data
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$htt ​p_r ​esp ​ons ​e_h ​eader
HTTP response headers
The $http_ ​res ​pon ​se_ ​header array is similar to
the get_h ​ead ​ers() function. When using the
HTTP wrapper, $http ​_re ​spo ​nse ​_he ​ader will be
populated with the HTTP response headers.
$http ​_re ​spo ​nse ​_he ​ader will be created in the
local scope.
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/wr ​app ​ers.ht ​tp.php
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/la ​ngu ​age.va ​ria ​ble ​s.s ​cop ​e.
php
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 14 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Predefined Variables (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$argc
The number of arguments passed to script
Contains the number of arguments passed to
the current script when running from the
command line.
Note: The script's filename is always passed as
an argument to the script, therefore the
minimum value of $argc is 1.
Note: This variable is not available when
regist ​er_ ​arg ​c_argv is disabled.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
$argv
Array of arguments passed to script
Contains an array of all the arguments passed
to the script when running from the command
line.
Note: The first argument $argv[0] is always the
name that was used to run the script.
Note: This variable is not available when
regist ​er_ ​arg ​c_argv is disabled.
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
PHP Array Functions
arra ​y_c ​han ​ge_ ​key ​_ca ​se()
Changes all keys in an array
■ http:/ ​/cd ​v.lt/Hn
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_c ​hun ​k()
Split an array into chunks■ http:/ ​/cd ​v.lt/Ho
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_c ​omb ​ine()
Creates an array by using one array for keys
and another for its values
■ http:/ ​/cd ​v.lt/Ht
 
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_c ​oun ​t_v ​alu ​es()
Counts all the values of an array
■ http:/ ​/cd ​v.lt/Hv
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_d ​iff ​_as ​soc()
Computes the difference of arrays with
additional index check
■ http:/ ​/cd ​v.lt/Hw
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_d ​iff ​_ke ​y()
Computes the difference of arrays using keys
for compar ​ison
■ http:/ ​/cd ​v.lt/Hx
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_d ​iff ​_ua ​sso ​c()
Computes the difference of arrays with
additional index check which is performed by a
user supplied callback function
■ http:/ ​/cd ​v.lt/I1
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_d ​iff ​_uk ​ey()
Computes the difference of arrays using a
callback function on the keys for compar ​ison
■ http:/ ​/cd ​v.lt/I2
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_d ​iff()
Computes the difference of arrays
■ http:/ ​/cd ​v.lt/I3
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_f ​ill ​_ke ​ys()
Fill an array with values, specifying keys
■ http:/ ​/cd ​v.lt/IH
 
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_f ​ill()
Fill an array with values
■ http:/ ​/cd ​v.lt/II
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_f ​ilt ​er()
Filters elements of an array using a callback
function
■ http:/ ​/cd ​v.lt/IJ
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_f ​lip()
Exchanges all keys with their associated values
in an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_i ​nte ​rse ​ct_ ​ass ​oc()
Computes the inters ​ection of arrays with
additional index check
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_i ​nte ​rse ​ct_ ​key()
Computes the inters ​ection of arrays using keys
for compar ​ison
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_i ​nte ​rse ​ct_ ​uas ​soc()
Computes the inters ​ection of arrays with
additional index check, compares indexes by a
callback function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_i ​nte ​rse ​ct_ ​uke ​y()
Computes the inters ​ection of arrays using a
callback function on the keys for compar ​ison
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 15 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Array Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_i ​nte ​rse ​ct()
Computes the inters ​ection of arrays
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_k ​ey_ ​exi ​sts()
Checks if the given key or index exists in the
array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_k ​eys()
Return all the keys or a subset of the keys of an
array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_m ​ap()
Applies the callback to the elements of the
given arrays
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_m ​erg ​e_r ​ecu ​rsi ​ve()
Merge two or more arrays recurs ​ively
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_m ​erg ​e()
Merge one or more arrays
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_p ​ad()
Pad array to the specified length with a value
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
 
PHP Array Functions (cont)
arra ​y_p ​op()
Pop the element off the end of array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_p ​rod ​uct()
Calculate the product of values in an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_p ​ush()
Push one or more elements onto the end of
array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_r ​and()
Pick one or more random entries out of an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_r ​edu ​ce()
Itera ​tively reduce the array to a single value
using a callback function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_r ​epl ​ace ​_re ​cur ​siv ​e()
Replaces elements from passed arrays into the
first array recurs ​ively
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_r ​epl ​ace()
Replaces elements from passed arrays into the
first array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_r ​eve ​rse()
Return an array with elements in reverse order
example
 
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_s ​ear ​ch()
Searches the array for a given value and
returns the corres ​ponding key if succes ​sful
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_s ​hif ​t()
Shift an element off the beginning of array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_s ​lic ​e()
Extract a slice of the array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_s ​pli ​ce()
Remove a portion of the array and replace it
with something else
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_s ​um()
Calculate the sum of values in an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​dif ​f_a ​sso ​c()
Computes the difference of arrays with
additional index check, compares data by a
callback function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​dif ​f_u ​ass ​oc()
Computes the difference of arrays with
additional index check, compares data and
indexes by a callback function
example
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 16 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​dif ​f()
Computes the difference of arrays by using a
callback function for data compar ​ison
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​int ​ers ​ect ​_as ​soc()
Computes the inters ​ection of arrays with
additional index check, compares data by a
callback function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​int ​ers ​ect ​_ua ​sso ​c()
Computes the inters ​ection of arrays with
additional index check, compares data and
indexes by a callback functions
example
------ ​​-- ​- ​-​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​int ​ers ​ect()
Computes the inters ​ection of arrays, compares
data by a callback function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​niq ​ue()
Removes duplicate values from an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_u ​nsh ​ift()
Prepend one or more elements to the beginning
of an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_v ​alu ​es()
Return all the values of an array
 
PHP Array Functions (cont)
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_w ​alk ​_re ​cur ​siv ​e()
Apply a user function recurs ​ively to every
member of an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_w ​alk()
Apply a user function to every member of an
array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y()
Create an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
comp ​act()
Create array containing variables and their
values
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
coun ​t()
Count all elements in an array, or something in
an object
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
curr ​ent()
Return the current element in an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
each()
Return the current key and value pair from an
array and advance the array cursor
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
 
PHP Array Functions (cont)
end()
Set the internal pointer of an array to its last
element
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
extr ​act()
Import variables into the current symbol table
from an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
in_a ​rra ​y()
Checks if a value exists in an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
key()
Fetch a key from an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
list()
Assign variables as if they were an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
next()
Advance the internal array pointer of an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
pos()
Alias of current
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
prev()
Rewind the internal array pointer
example
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 17 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rang ​e()
Create an array containing a range of elements
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rese ​t()
Set the internal pointer of an array to its first
element
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
size ​of()
Alias of count
ARRAY SORTING FUNCTI ​ONS
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arra ​y_m ​ult ​iso ​rt()
Sort multiple or multi- ​dim ​ens ​ional arrays
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
asor ​t()
Sort an array and maintain index associ ​ation
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
arso ​rt()
Sort an array in reverse order and maintain
index associ ​ation
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
krso ​rt()
Sort an array by key in reverse order
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ksor ​t()
 
PHP Array Functions (cont)
Sort an array by key
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
natc ​ase ​sor ​t()
Sort an array using a case insens ​itive " ​natural
order" algorithm
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
nats ​ort()
Sort an array using a " ​natural order" algorithm
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
rsor ​t()
Sort an array in reverse order
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
shuf ​fle()
Shuffle an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
sort()
Sort an array
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
uaso ​rt()
Sort an array with a user-d ​efined comparison
function and maintain index associ ​ation
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ukso ​rt()
Sort an array by keys using a user-d ​efined
comparison function
example
 
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
usor ​t()
Sort an array by values using a user-d ​efined
comparison function
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
Comp ​arison of array sorting functi ​ons
http:/ ​/ph ​p.n ​et/ ​man ​ual ​/en ​/ar ​ray.so ​rti ​ng.php
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
ARRAY CONSTA ​NTS
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
CASE ​_LO ​WER
Used with array_ ​cha ​nge ​_ke ​y_c ​ase() to convert
array keys to lower case
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
CASE ​_UP ​PER
Used with array_ ​cha ​nge ​_ke ​y_c ​ase() to convert
array keys to upper case
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_ASC
Used with array_ ​mul ​tis ​ort() to sort in ascending
order
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_DESC
Used with array_ ​mul ​tis ​ort() to sort in
descending order
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_RE ​GULAR
Used to compare items normally
By krabat1 (krabat1)
cheatography.com/krabat1/ 
Published 8th December, 2012.
Last updated 2nd June, 2014.
Page 18 of 42.
 
Sponsored by Readability-Score.com
Measure your website readability!
https://readability-score.com
PHP Cheat Sheet
by krabat1 (krabat1) via cheatography.com/2778/cs/706/
PHP Array Functions (cont)
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_NU ​MERIC
Used to compare items numeri ​cally
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_ST ​RING
Used to compare items as strings
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
SORT ​_LO ​CAL ​E_S ​TRING
Used to compare items as strings, based on the
current locale
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​--
COUN ​T_N ​ORMAL
COUN ​T_R ​ECU ​RSIVE
EXTR ​_OV ​ERW ​RITE
EXTR ​_SKIP
EXTR ​_PR ​EFI ​X_S ​AME
EXTR ​_PR ​EFI ​X_ALL
EXTR ​_PR ​EFI ​X_I ​NVA ​LID
EXTR ​_PR ​EFI ​X_I ​F_E ​XISTS
EXTR ​_IF ​_EX ​ISTS
EXTR ​_REFS
PHP String Functions
addc ​sla ​she ​s()
Quote string with slashes in a C style
example
------ ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​-- ​​--- ​​-- ​- ​- ​--

Outros materiais