For over 5+ years we help companies reach their financial and branding goals. oDesk Software Co., Ltd is a values-driven technology agency dedicated

Gallery

Contacts

Address

108 Tran Dinh Xu, Nguyen Cu Trinh Ward, District 1, Ho Chi Minh City, Vietnam

E-Mail Address

info@odesk.me

Phone

(+84) 28 3636 7951

Hotline

(+84) 76 899 4959

Websites Development

PHP Cheat Sheet

Variable Handling Functions  

Variables in PHP are containers for storing data. 

  • A variable name is preceded with a $ sign. 
  • It must start with a variable or an underscore.
  • A variable cannot be started with a number.
  • A variable can only contain alphanumeric characters.
  • Variables are case-sensitive. $Result and $result are treated as two different variables.

Variable Functions allow us to define, use and manipulate variables as required.

1. boolvalReturns the boolean value of a variable.
2. debug_zval_dumpDumps the string representation of an internal zend value to output.
3.doublevalAlias of floatval.
4.emptyDetermines whether a variable is empty.
5.floatvalReturns the Float Value of a variable.
6.get_defined_varsReturns an Array of all defined variable.
7.get_resource_typeReturns the resource type.
8.gettypeReturns the type of a variable.
9.import_request_variablesImports GET/POST/Cookie variables into the resource type.
10.intvalGet the integer value of the variable.
11.is_arrayDetermines whether the variable is an array
12.is_boolDetermines whether a variable is Boolean
13.is_callableVerifies if the contents of a variable can be called a function.
14.is_float | is double | is_realDetermines whether the type of a variable is ‘float’.
15.is_int| is_integer | is_longDetermines whether the type of variable is an integer.
16.is_nullDetermines whether a variable is NULL
17.is_numericDetermines whether a variable is a number or a numeric string.
18.is_objectDetermines whether a variable is an object.
19.is_resourceDetermines whether a variable is a resource.
20.is_scalarDetermines whether a variable is scalar.
21.is_stringDetermines whether the type of variable is string.
22.issetDetermines if a variable is set and not NULL.
23.print_rPrints information in human readable format.
24.serializeGenerates a storable representation of a value.
25.settypeSet the type of a variable.
26.strvalGet the string value of a variable.
27.unserializeCreates a PHP value of a stored variable.
28.UnsetUnsets a given variable
29.var_dumpDumps information about a variable.
30.var_exportOutputs or returns a parsable string representation of a variable.

Array Functions

An array is used to store a list of values in one single variable. The values can be accessed by referring to an index number which always starts with 0. Arrays can be:

  • Indexed: Default Array Format. Values can be accessed by index number.
  • Associative: Use named keys.
  • Multidimensional: Can also be referred as a matrix. It contains one or more arrays. You can also think of it as a nested array.

Array Functions allow us to define, store, traverse data and information as required.

1.array()Declares and creates an Array.
2.array_change_key_case()Returns an array with all keys in lowercase or uppercase. 
3.array_chunk()Splits an array into chunks of Array.
4.array_combine()Creates an array by using one array for keys and one for values.
5.array_count_values()Returns an array with the number of occurrences for each value.
6.array_diff()Compares array values and returns the differences.
7.array_diff_assoc()Compares array key and values and returns the differences.
8.array_diff_key()Compares array keys and returns the differences.
9.array_diff_uassoc()Compares array keys and values, with an additional user made function check, and returns the differences.
10.array_diff_ukey()Compares array keys, with an additional user made function check, and returns the differences. 
11.array_fill()Fills an array with values.
12.array_filter()Filters elements of an array through a user-made function.
13.array_flip()Exchanges all keys with their associated values in the array.
14.array_intersect()Compares array values and returns the matches
15.array_intersect_assoc()Compares array keys and values and returns the matches.
16.array_intersect_key()Compares array keys and returns the matches.
17.array_intersect_uassoc()Compares keys and values, with an additional user-made function check and return the matches.
18.array_intersect_ukey()Compares the keys, with an additional user-made function check and return the matches.
19.array_key_exists()Determines if the specified keys exists in the array.
20.array_keys()Returns all keys of an array.
21.array_map()Send each value of an array to a user-made function, which returns new values.
22.array_merge() | array_merge_recursive()Merges one or more arrays into one array.
23.array_multisort()Sorts multiple or multi-dimensional arrays.
24.array_pad()Inserts a specified number of items, with a specified value, to an array.
25.array_pop()Deletes the last element of an array.
26.array_product()Calculates the product of the values in an array.
27.array_push()Inserts one or more elements to the end of an array.
28.array_rand()Returns one or more random keys from an array.
     29.array_reduce()Returns an array as a string, using a user defined function.
30.array_reverse()Returns an array in the reverse order.
31.array_search()Searches an array for a given value and returns the key.
32.array_shift()Removes the first element from an array, and returns the value of the removed element.
33.array_slice()Removes and replaces specified elements of an array.
34.array_splice()Removes and replaces specified elements of an array
35.array_sum()Returns the sum of the values in an array.
36.array_udiff()Compares array values in a user-made function and returns an array.
37.array_udiff_assoc()Compares array keys, and compares array values in a user-made function, and returns an array.
38.array_udiff_uassoc()Compares array keys and array values in user-made functions, and returns an array. 
39.array_uintersect()Compares array values in a user-made function and returns an array.
40.array_uintersect_assoc()Compares array keys, and compares array values in a user-made function, and returns an array.
41.array_uintersect_uassoc()Compares array keys and array values is user-made functions, and returns an array.
42.array_unique()Removes duplicate values from an array.
43.array_unshift()Adds one or more elements to the beginning of an array.
44.array_values()Returns all the values of an array.
45.array_walk()Applies a user function to every member of an array.
46.array_walk_recursive()Applies a user function recursively to every member of an array.
47.arsort()Sorts an array in reverse order and maintains index association.
48.asort()Sorts an array and maintains index association.
49.compact()Create array containing variables and their values.
50.count()Counts elements in an array, or properties in an object.
51.current()Returns the current element in an array
52.each()Returns the current key and value pair from an array
53.end()Sets the internal pointer of an array to its last element.
54.extract()Imports variables into the current symbol table from an array.
55.in_array()Checks if a specified value exists in an array.
56.key()Fetches a key from an array.
57.krsort()Sorts an array by key in reverse order.
58.ksort()Sorts an array by key.
59.list()Assigns variables as if they were an array.
60.natcasesort()Sorts an array using a case insensitive.
61.natsort()Sorts an array
62.next()Advance the internal array pointer of an array
63.pos()Alias of current.
64.prev()Rewinds the internal array pointer.
65.range()Creates an array containing a range of elements.
66.reset()Sets the internal pointer of an array to its first element.
67.rsort()Sorts an array in reverse order.
68.shuffle()Shuffles an array
69.sizeof()Alias of count()
70.sort()Sorts an array
71.uasort()Sorts an array with a user-defined function and maintain index association.
72.uksort()Sorts an array by keys using a user-defined function
73.usort()Sorts an array by values using a user-defined function.

Array Constants

1.CASE_LOWERUsed with array_change_key_case() to convert array keys to lowercase
2.CASE_UPPERUsed with array_change_key_case() to convert array keys to uppercase
3. SORT_ASCUsed with array_multisort() to sort in ascending order
4.SORT_DESCUsed with array_multisort() to sort in descending order
5.SORT_REGULARUsed to compare items normally
6.SORT_NUMERICUsed to compare items numerically
7.SORT_STRINGUsed to compare items as strings
8.SORT_LOCALE_STRINGUsed to compare items as strings, based on the current locale
9.COUNT_NORMALCounts all elements in an array.
10.COUNT_RECURSIVERecursively counts the elements in an array.
11.EXTR_OVERWRITEImports variables from an array into the current symbol table.
12.EXTR_SKIPIt is an extraction flag. If there is a collision, do not overwrite the existing variable.
13.EXTR_PREFIX_SAMEIf there is a collision, prefix the variable name with prefix.
14.EXTR_PREFIX_ALLPrefix all variable names with prefix.
15.EXTR_PREFIX_INVALIDOnly prefix invalid/numeric variable names with prefix.
16.EXTR_PREFIX_IF_EXISTSOnly create prefixed variable names if the non-prefixed version of the same variable exists in the current symbol table.
17.EXTR_IF_EXISTSOnly overwrite the variable if it already exists in the current symbol table, otherwise do nothing. This is useful for defining a list of valid variables and then extracting only those variables defined out of $_REQUEST.
18.EXTR_REFSExtracts variables as references. This means the values of the imported variables are still referencing the values of the array parameter. 

String Functions

Strings are a sequence of characters. It is a data type. It can be alphanumeric as well. Strings are created by declaring a variable and assigning string characters to it. String Functions allow us to manipulate and handle strings as required.

1.addcslashes()Returns a string with backslashes in front of the specified characters.
2.addslashes()Returns a string with backslashes in front of predefined characters.
3.bin2hex()Converts a string of ASCII characters to hexadecimal values.
4.chop()Alias of rtrim()
5.chr()Returns a character from a specified ASCII value.
6.chunk_split()Split a string into a series of smaller parts.
7.convert_cyr_string()Converts a string from one Cyrillic character-set to another.
8.convert_uudecode()Decodes a uuencoded string.
9.convert_uuencode()Encodes a string using the uuencode algorithm.
10.count_chars()Returns how many times an ASCII character occurs within a string and returns the information.
11.crc32()Calculates a 32-bit CRC for a string.
12.crypt()One-way string encryption (hashing)
13.echo()Outputs strings
14.explode()Breaks a string into an array.
15.fprintf()Writes a formatted string to a specified output stream.
16.get_html_translation_table()Returns the translation table used by htmlspecialchars() and htmlentities()
17.hebrev()Converts Hebrew text to visual text.
18.hebrevc()Converts Hebrew text to visual text and new lines(\n) into <br/>
19.html_entity_decode()Converts HTML entities to characters.
20.htmlentities()Converts characters to HTML entities.
21.htmlspecialchars_decode()Converts some predefined HTML entities to characters.
22.htmlspecialchars()Converts some predefined characters to HTML entities.
23.implode()Returns a string from the elements of an array.
24.join()Alias of implode()
25.levenshtein()Returns the Levenshtein distance between two strings.
26.localeconv()Returns locale numeric and monetary formatting information.
27.ltrim()Strips whitespaces from the left side of a string.
28.md5()Calculates the md5 hash of a string.
29.md5_file()Calculates the md5 hash of a file.
30.metaphone()Calculates the metaphone key of a string.
31.money_format()Returns a string formatted as a currency string.
32.nl_langinfo()Returns a specific local information.
33.nl2br()Inserts HTML line breaks in front of each newline in a string.
34.number_format()Formats a number with grouped thousands.
35.ord()Returns the ASCII value of the first character of a string.
36.parse_str()Parses a query string into variables.
37.print()Outputs a string.
38.printf()Outputs a formatted string.
39.quoted_printable_decode()Decodes a quoted-printable string.
40.quotemeta()Quotes meta-characters.
41.rtrim()Strips whitespace from the right side of a string.
42.setlocale()Sets locale information.
43.sha1()Calculates the SHA-1 hash of a string.
44.sha1_file()Calculates the SHA-1 hash of a file.
45.similar_text()Calculates the similarity between two strings.
46.soundex()Calculates the soundex key of a string
47.sprintf()Writes a formatted string to a variable.
48.sscanf()Parses input from a string according to a format.
49.str_ireplace()Replaces some characters in a string(case-insensitive)
50.str_pad()Pads a string to a new length.
51.str_repeat()Repeats a string a specified number of times.
52.str_replace()Replaces some characters in a string(case-sensitive)
53.str_rot13()Performs the ROT13 encoding on a string.
54.str_shuffle()Randomly shuffles all characters in a string.
55.str_split()Splits a string into an array.
56.str_word_count()Count the number of words in a string.
57.strcasecmp()Compares two strings (case-insensitive)
58.strchr()Finds the first occurrence of a string inside another string (alias of strstr())
59.strcmp()Compares two strings (case-sensitive)
60.strcoll()Locale based string comparison
61.strcspn()Returns the number of characters found in a string before any part of some specified characters are found.
62.strip_tags()Strips HTML and PHP tags from a string.
63.stripcslashes()Unquotes a string quoted with addcslashes()
64.stripslashes()Unquotes a string quoted with addslashes()
65.stripos()Returns the position of the first occurrence of a string inside another string (case-insensitive)
66.stristr()Finds the first occurrence of a string inside another string(case-insensitive)
67.strlen()Returns the length of a string
68.strnatcasecmp()Compares two strings
69.strnatcmp()Compares two strings
70.strncasecmp()String comparison of the first n characters (case -insensitive)
71.strncmp()String comparison of the first n characters (case – sensitive)
72.strpbrk()Searches a string for any of a set of characters.
73.strpos()Returns the position of the first occurrence of a string inside another string(case-sensitive)
74.strrchr()Finds the last occurrence of a string inside another string.
75.strrev()Reverses a string
76.strripos()Finds the position of the last occurrence of a string inside another string(case-insensitive)
77.strrpos()Finds the position of the last occurrence of a string inside another string (case – sensitive)
78.strspn()Returns the number of characters found in a string that contains only characters from a specified charlist.
79.strstr()Finds the first occurrence of a string inside another string(case-sensitive)
78.strtok()Splits a string into smaller strings.
79.strtolower()Converts a string to lowercase letters.
80.strtoupper()Converts a string to uppercase letters.
81.strtr()Translates certain characters in a string.
82.substr()Returns a part of a string.
83.substr_compare()Compares two strings from a specified start position (binary safe and optionally case-sensitive)
84.substr_count()Counts the number of times a substring occurs in a string.
85.substr_replace()Replaces a part of a string with another string.
86.trim()Strips whitespace from both sides of a string.
87.ucfirst()Converts the first character of a string to uppercase.
88.ucwords()Converts the first character of each word in a string to uppercase.
89.vfprintf()Writes a formatted string to a specified output stream.
90.vprintf()Outputs a formatted string.
91.vsprintf()Writes a formatted string to a variable.
92.wordwrap()Wraps a string to a given number of characters.

String Constants

1.CRYPT_SALT_LENGTHContains the length of the default encryption method for the system. For standard DES encryption, the length is 2
2.CRYPT_STD_DESSet to 1 if the standard DES-based encryption with a 2 character salt is supported, 0 otherwise
3.CRYPT_EXT_DESSet to 1 if the extended DES-based encryption with a 9 character salt is supported, 0 otherwise
4.CRYPT_MD5Set to 1 if the MD5 encryption with a 12 character salt starting with $1$ is supported, 0 otherwise
5.CRYPT_BLOWFISHSet to 1 if the Blowfish encryption with a 16 character salt starting with $2$ or $2a$ is supported, 0 otherwise
6.HTML_SPECIALCHARSConverts some predefined characters to HTML entities.
7.HTML_ENTITIESConverts a special character in an input string into the form of an HTML character.
8.ENT_COMPATConverts double quotes 
9.ENT_QUOTESWill convert both single and double quotes.
10.ENT_NOQUOTESWill leave both single and double quotes unconverted.
11.ENT_IGNORESilently discard invalid code unit sequences instead of returning an empty string. Using this flag is discouraged as it may have security implications.
12.ENT_SUBSTITUTEReplace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or &#xFFFD; (otherwise) instead of returning an empty string.
13.ENT_DISALLOWEDReplace invalid code points for the given document type with a Unicode Replacement Character U+FFFD (UTF-8) or &#xFFFD; (otherwise) instead of leaving them as is. This may be useful, for instance, to ensure the well-formedness of XML documents with embedded external content.
14.ENT_HTML401Handle code as HTML 4.01.
15.ENT_XML1Handle code as XML 1.
16.ENT_XHTMLHandle code as XHTML.
17.ENT_HTML5Handle code as HTML 5.
18.CHAR_MAXIf an array element is equal to CHAR_MAX, no further grouping is done.
19.LC_CTYPEFor character classification and conversion.
20.LC_NUMERICUsed for decimal separator.
21.LC_TIMEFor date and time formatting.
22.LC_COLLATEFor string comparison.
23.LC_MONETARYFor localeconv()
24.LC_ALLFor all LC_ functions.
25.LC_MESSAGESFor system responses.
26.STR_PAD_LEFTPad left side of an input string.
27.STR_PAD_RIGHTPad right side of an input string.
28.STR_PAD_BOTHPad both sides of an input string.

Math Functions

Math functions are used to handle values within the range of integer and float types. 

1.abs()Returns the absolute value of a number.
2.acos()Returns the arccosine of a number.
3.acosh()Returns the inverse hyperbolic cosine of a number.
4.asin()Returns the arcsine of a number.
5.asinh()Returns the inverse hyperbolic sine of a number.
6.atan()Returns the arctangent of a number as a numeric value between: -pi/2 and +pi/2  radians.
7.atan2()Returns the angle theta of an (x,y) point as a numeric value between -pi and +pi radians.
8.atanh()Returns the inverse hyperbolic tangent of a number.
9.base_convert()Converts a number from one base to another.
10.bindec()Converts a binary number to a decimal number.
11.ceil()Returns the value of a number rounded upwards to the nearest integer.
12.cos()Returns the cosine of a number.
13.cosh()Returns the hyperbolic cosine of a number.
14.decbin()Converts a decimal number to a binary number.
15.dechex()Converts a decimal number to a hexadecimal number.
16.decoct()Converts a decimal number to an octal number.
17.deg2rad()Converts a degree to a radian number.
18.exp()Returns the value of E
19.expm1()Returns the value of E
20.floor()Returns the value of a number rounded downwards to the nearest integer.
21.fmod()Returns the remainder(modulo) of the division of the arguments.
22.getrandmax()Returns the maximum random number that can be returned by a call to the rand() function.
23.hexdec()Converts a hexadecimal number to a decimal number.
24.hypot()Returns the length of the hypotenuse of a right-angle triangle.
25.is_finite()Returns true if a value is a finite number.
26.is_infinite()Returns true if a value is an infinite number.
27.is_nan()Returns true if a value is not a number
28.lcg_value()Returns a pseudo random number in the range of (0,1)
29.log()Returns the natural logarithm(base E) of a number.
30.log10()Returns the base-10 logarithm of a number.
31.log1p()Returns log(1+number)
32.max()Returns the number with the highest value of two specified numbers.
33.min()Returns the number with the lowest value of two specified numbers.
34.mt_getrandmax()Returns the largest possible value that can be returned by mt_rand()
35.mt_rand()Returns a random integer using Mersenne Twister algorithm.
36.mt_srand()Seeds the Mersenne Twister random number generator.
37.octdec()Converts an octal number to a decimal number.
38.pi()Returns the value of pi
39.pow()Returns the value is x to the power of y.
40.rad2deg()Converts a radian number to a degree
41.rand()Returns a random integer
42.round()Rounds a number to the nearest integer.
43.sin()Returns the sine of a number.
44.sinh()Returns the hyperbolic sine of a number.
45.sqrt()Returns the sqrt of a number.
46.srand()Seeds the random number generator.
47.tan()Returns the tangent of an angle.
48.tanh()Returns the hyperbolic tangent of an angle.

Math Constants

1.M_EReturns e (approx. 2.718)
2.M_EULERReturns Euler’s constant (approx. 0.577)
3.M_LNPIReturns the natural logarithm of PI (approx. 1.144)
4.M_LN2Returns the natural logarithm of 2 (approx. 0.693)
5.M_LN10Returns the natural logarithm of 10 (approx. 2.302)
6.M_LOG2EReturns the base-2 logarithm of E (approx. 1.442)
7.M_LOG10EReturns the base-10 logarithm of E (approx. 0.434)
8.M_PIReturns PI (approx. 3.14159)
9.M_PI_2Returns PI/2 (approx. 1.570)
10.M_PI_4Returns PI/4 (approx. 0.785)
11.M_1_PIReturns 1/PI (approx. 0.318)
12.M_2_PIReturns 2/PI (approx. 0.636)
13.M_SQRTPIReturns the square root of PI (approx. 1.772)
14.M_2_SQRTPIReturns 2/square root of PI (approx. 1.128)
15.M_SQRT1_2Returns the square root of 1/2 (approx. 0.707)
16.M_SQRT2Returns the square root of 2 (approx. 1.414)
18M_SQRT3Returns the square root of 3 (approx. 1.732)

Date/Time Functions

The date/time functions allow getting the date and time from the server where the PHP script runs. These functions can also be used to format date/time functions as required.

1.checkdate()Validates a Gregorian Data
2.date_default_timezone_get()Returns the default time zone.
3.date_default_timezone_set()Sets the default time zone.
4.date_sunrise()Returns the time of sunrise for the time or location.
5.date_sunset()Returns the time of sunset for the time or location.
6.date()Formats a local time/date.
7.getdate()Returns an array that contains the date and time stamp information for a Unix timestamp.
8.gettimeofday()Returns an array that contains the current time information.
9.gmdate()Formats a GMT/UTC date/time
10.gmmktime()Returns the Unix timestamp for a GMT Table.
11.gmstrftime()Formats a GMT/UTC time/date according to locale settings.
12.idate()Formats a local time/date as an integer.
13.localtime()Returns an array that contains the time components of a Unix Timestamp.
14.microtime()Returns the current time in microseconds.
15.mktime()Returns the Unix timestamp for a date.
16.strftime()Formats the local time date according to locale settings.
17.strptime()Parses a time/date generated with strftime()
18.strtotime()Parses English textual date or time into a Unix timestamp.
19time()Returns the current time as a Unix timestamp.

Date/Time Constants

1.DATE_ATOMAtom (example: 2005-08-15T16:13:03+0000)
2.DATE_COOKIEHTTP Cookies (example: Sun, 14 Aug 2005 16:13:03 UTC)
3.DATE_ISO8601ISO-8601 (example: 2005-08-14T16:13:03+0000)
4.DATE_RFC822RFC 822 (example: Sun, 14 Aug 2005 16:13:03 UTC)
5.DATE_RFC850RFC 850 (example: Sunday, 14-Aug-05 16:13:03 UTC)
6.DATE_RFC1036RFC 1036 (example: Sunday, 14-Aug-05 16:13:03 UTC)
7.DATE_RFC1123RFC 1123 (example: Sun, 14 Aug 2005 16:13:03 UTC)
8.DATE_RFC2822RFC 2822 (Sun, 14 Aug 2005 16:13:03 +0000)
9.DATE_RSSRSS (Sun, 14 Aug 2005 16:13:03 UTC)
10.DATE_W3CWorld Wide Web Consortium (example: 2005-08-14T16:13:03+0000)

Calendar Functions

The Calendar extension contains functions that simplify the conversion between two different calendar formats.

1.cal_days_in_month()Returns the number of days in a month for a specified year and calendar
2.cal_from_jd()Converts a Julian day count into a date of a specified calendar.
3.cal_info()Returns information about a given calendar
4.cal_to_jd()Converts a date to Julian day count.
5.easter_date()Returns the Unix timestamp for midnight on Easter of a specified month.
6.easter_days()Returns the number of days after March 21, on which Easter falls for a specified year.
7.FrenchToJD()Converts a French Republican date to a Julian day count.
8.GregorianToJD()Converts a Gregorian Date to a Julian day count.
9.JDDayOfWeek()Returns the day of the week.
10.JDMonthName()Returns a month name.
11.JDToFrench()Converts a Julian day count to a French Republican date.
12.JDToGregorian()Converts a Julian day count to a Gregorian Date.
13.jdtojewish()Converts a Julian day count to a Jewish date.
14.JDToJulian()Converts a Julian day count to a Julian date.
15.jdtounix()Converts a Julian day count to a Unix timestamp.
16.JewishToJD()Converts a Jewish date to a Julian day count.
17.JulianToJD()Converts a Julian date to a Julian day count.
18.unixtojd()Converts a Unix timestamp to a Julian day count.

Calendar Constants

1.CAL_GREGORIANGregorian Calendar
2.CAL_JULIANJulian Calendar
3.CAL_JEWISHJewish Calendar
4.CAL_FRENCHFrench Republican Calendar.
5.CAL_NUM_CALSThe number of available calendars.
6.CAL_DOW_DAYNOThe day of the week as integer, where 0 means Sunday and 6 means Saturday.
7.CAL_DOW_SHORTThe abbreviated English name of the day of the week.
8.CAL_DOW_LONGThe English name of the day of the week.
9.CAL_MONTH_GREGORIAN_SHORTThe abbreviated Gregorian month name.
10.CAL_MONTH_GREGORIAN_LONGThe Gregorian month name.
11.CAL_MONTH_JULIAN_SHORTThe abbreviated Julian month name.
12.CAL_MONTH_JULIAN_LONGThe Julian month name.
13.CAL_MONTH_JEWISHThe Jewish month name.
14.CAL_MONTH_FRENCHThe French Republican month name.
15.CAL_EASTER_DEFAULTCalculate Easter for years before 1753 according to the Julian calendar, and for later years according to the Gregorian calendar.
16.CAL_EASTER_ROMANCalculate Easter for years before 1583 according to the Julian calendar, and for later years according to the Gregorian calendar.
17.CAL_EASTER_ALWAYS_GREGORIANCalculate Easter according to the proleptic Gregorian calendar.
18.CAL_EASTER_ALWAYS_JULIANCalculate Easter according to the Julian calendar.
19.CAL_JEWISH_ADD_ALAFIM_GERESHAdds a geresh symbol (which resembles a single-quote mark) as thousands separator to the year number.
20.CAL_JEWISH_ADD_ALAFIMAdds the word alafim as thousands separator to the year number.
21.CAL_JEWISH_ADD_GERESHAYIMAdd a gershayim symbol (which resembles a double-quote mark) before the final letter of the day and year numbers.

Directory Functions

The directory functions are used to retrieve information about directories and their contents.

1.chdir()Changes the current directory
2.chroot()Changes the root directory to the current process.
3.dir()Opens the directory handle and returns an object.
4.closedir()Closes the directory handle.
5.getcwd()Returns the current directory.
6.opendir()Open a directory handle.
7.readdir()Returns an entry from the directory handle.
8.rewinddir()Resets a directory handle.
9.scandir()Lists the files and directory inside a specified path.

Directory Constants

1.DIRECTORY_SEPARATORIn different OS there is different directory separator. In Windows it’s \ in Linux it’s /. DIRECTORY_SEPARATOR is constant with that OS directory separator. 
2.PATH_SEPARATORSemicolon on windows, colon otherwise.

File System Functions

These functions allow to access and manipulate the filesystem. 

1.basename()Returns the filename component of a path.
2.chgrp()Changes the file group.
3.chmod()Changes the file mode
4.chown()Changes the file owner
5.clearstatcache()Clears the file status cache
6.copy()Copies a file
7.delete()Delete a file
8.dirname()Returns the directory name component of a path
9.disk_free_space() | diskfreespace()Returns the free space of a directory
10.disk_total_space()Returns the total size of a directory
11.fclose()Closes an open file
12.feof()Tests for end-of-file on an open file
13.fflush()Flushes buffered output to an open file.
14.fgetc()Returns a character from an open file
15.fgetcsv()Checks and parses a line in an open file.
16.fgets()Returns a line from an open file.
17.fgetss()Returns a line, with HTML and PHP tags removed, from an open file.
18.file()Reads a file into an array
19.file_exists()Checks whether or not a file or a directory exists.
20.file_get_contents()Reads a file into a string
21.file_put_contentsWrites a string to a file
22.fileatime()Returns the last access time of a file
23.filectime()Returns the last change time of a file.
24.filegroup()Returns the group ID of a file
25.fileinode()Returns the inode number of a file
26.filemtime()Returns the last modification time of a file
27.fileowner()Returns the user ID(owner) of a file
28.fileperms()Returns the permissions of a file.
29.filesize()Returns the file size.
30.filetype()Returns the file type.
31.flock()Locks or releases a file.
32.fnmatch()Matches a filename or string against a specified pattern
33.fopen()Opens a file or URL
34.fpassthru()Reads from an open file, until EOF, and writes the result to the output buffer.
35.fputcsv()Formats a line as CSV and writes it to an open file.
36.fputs()Alias of fwrite.
37.fread()Reads from an open file.
38.fscanf()Parses input form an open file according to a specified format.
39.fseek()Seeks in an open file.
40.fstat()Returns information about an open file.
41.ftell()Returns the current position in an open file.
42.ftruncate()Truncates an open file to a specified length.
43.fwrite()Writes to an open file. 
44.glob()Returns an array of filenames/directories matching a specified pattern.
45.is_dir()Checks whether a file is a directory.
46.is_executable()Checks whether a file is executable.
47.is_file()Checks whether a file is a regular file.
48.is_link()Check whether a file is a link.
49.is_readable()Checks whether a file is readable.
50.is_uploaded_file()Checks whether a file was uploaded via HTTP POST
51.is_writable()|is_writeable()Checks whether a file is readable.
52.link()Creates a hard link
53.linkinfo()Returns information about a hard link.
54.lstat()Returns information about a file or symbolic link
55.mkdir()Creates a directory.
56.move_uploaded_file()Moves an uploaded file to a new location.
57.parse_ini_file()Parses a configuration file.
58.pathinfo()Returns information about a file path.
59.pclose()Closes a pipe opened by popen()
60.popen()Opens a pipe
61.readfile()Reads a file and writes it to the output buffer.
62.readlink()Returns the target of a symbolic link.
63.realpath()Returns the absolute pathname.
64.rename()Renames a file or directory.
65.rewind()Rewinds a file pointer.
66.rmdir()Removes an empty directory.
67.set_file_buffer()Sets the buffer size if an open file.
68.stat()Returns information about a file.
69.symlink()Creates a symbolic link
70.tempnam() | tmpfile()Creates a unique temporary file
71.touch()Sets access and modification time of a file.
72.umask()Changes file permissions for files.
73.unlink()Deletes a file.

File System Constants

1.GLOB_BRACEExpands to match ‘a’, ‘b’, or ‘c’
2.GLOB_ONLYDIRReturn only directory entries which match the pattern
3.GLOB_MARKAdds a slash to each directory returned
4.GLOB_NOSORTReturn files as they appear in the directory (no sorting). When this flag is not used, the path names are sorted alphabetically
5.GLOB_NOCHECKReturn the search pattern if no files matching it were found
6.GLOB_NOESCAPEBackslashes do not quote metacharacters.
7.GLOB_ERRStop on read errors (like unreadable directories), by default errors are ignored.
8.PATHINFO_DIRNAMEReturns information about the path directory.
9.PATHINFO_BASENAMEReturns information about the path basename.
10.PATHINFO_EXTENSIONReturns information about the path extension.
11.FILE_USE_INCLUDE_PATHSearch for the file in the include path.
12.FILE_APPENDAppend a file to a file. The target file needs to be writable for this.
13.FILE_IGNORE_NEW_LINESOmit newline at the end of each array element.
14.FILE_SKIP_EMPTY_LINESSkips empty lines.

Zip Functions

These functions allow you to read zip files. The ZIP extension requires libzip which is a C library for reading, creating and modifying zip archives. 

1.zip_close()Closes a ZIP File
2.zip_entry_close()Closes an entry in the ZIP file
3.zip_entry_compressedsize()Returns compressed size of an entry in the ZIP file.
4.zip_entry_compressionmethod()Returns the compression method of an entry in the ZIP File. 
5.zip_entry_filesize()Returns the actual file size of an entry in the ZIP File.
6.zip_entry_name()Returns the name of an entry in the ZIP File.
7.zip_entry_open()Opens an entry in the ZIP File for reading.
8.zip_entry_read()Reads from an open entry in the ZIP File.
9.zip_open()Opens a ZIP File
10.zip_read()Reads the next entry in the ZIP File.

Filter Functions

These functions are used to validate and filter data coming from insecure input sources. These filter functions are enabled by default. 

1.filter_has_var()Checks if a variable of a specified input type exist.
2.filter_id()Returns the ID number of a specified filter.
3.filter_input()Get input from outside the script and filter it.
4.filter_input_array()Get multiple inputs from outside the script and filters them.
5.filter_list()Returns an array of all supported filters
6.filter_var_array()Get multiple variables and filter them.
7.filter_var()Get a variable and filter it.

Filter Constants

1.FILTER_DEFAULTDo nothing, optionally strip/encode special characters. Equivalent to FILTER_UNSAFE_RAW
2.FILTER_FLAG_NONEAllows no flags
3.FILTER_FLAG_ALLOW_OCTALOnly for inputs that starts with a zero (0) as octal numbers. This only allows the succeeding digits to be 0-7
4.FILTER_FLAG_ALLOW_HEXOnly for inputs that starts with 0x/0X as hexadecimal numbers. This only allows succeeding characters to be a-fA-F0-9
5.FILTER_FLAG_STRIP_LOWStrip characters with ASCII value lower than 32
6.FILTER_FLAG_STRIP_HIGHStrip characters with ASCII value greater than 127
7.FILTER_FLAG_ENCODE_LOWEncode characters with ASCII value lower than 32
8.FILTER_FLAG_ENCODE_HIGHEncode characters with ASCII value greater than 127
9.FILTER_FLAG_ENCODE_AMPEncode &
10.FILTER_FLAG_NO_ENCODE_QUOTESDo not encode ‘ and “
11.FILTER_FLAG_EMPTY_STRING_NULLNot in use
12.FILTER_FLAG_ALLOW_FRACTIONAllows a period (.) as a fractional separator in numbers
13.FILTER_FLAG_ALLOW_THOUSANDAllows a comma (,) as a thousands separator in numbers
14.FILTER_FLAG_ALLOW_SCIENTIFICAllows an e or E for scientific notation in numbers
15.FILTER_FLAG_PATH_REQUIREDThe URL must contain a path part
16.FILTER_FLAG_QUERY_REQUIREDThe URL must contain a query string
17.FILTER_FLAG_IPV4Allows the IP address to be in IPv4 format
18.FILTER_FLAG_IPV6Allows the IP address to be in IPv6 format
19.FILTER_FLAG_NO_RES_RANGEFails validation for the reserved IPv4 ranges: 0.0.0.0/8, 169.254.0.0/16, 127.0.0.0/8 and 240.0.0.0/4, and for the reserved IPv6 ranges: ::1/128, ::/128, ::ffff:0:0/96 and fe80::/10
20.FILTER_FLAG_NO_PRIV_RANGEFails validation for the private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and for the IPv6 addresses starting with FD or FC
21.FILTER_FLAG_EMAIL_UNICODEAllows the local part of the email address to contain Unicode characters
22.FILTER_REQUIRE_SCALARThe value must be a scalar
23.FILTER_REQUIRE_ARRAYThe value must be an array
24.FILTER_FORCE_ARRAYTreats a scalar value as an array with the scalar value as only element
25.FILTER_NULL_ON_FAILUREReturn NULL on failure for unrecognized boolean values
26.FILTER_VALIDATE_BOOLEANValidates a boolean
27.FILTER_VALIDATE_EMAILValidates value as a valid email address
28.FILTER_VALIDATE_FLOATValidates value as float
29.FILTER_VALIDATE_INTValidates value as integer
30.FILTER_VALIDATE_IPValidates value as IP address
31.FILTER_VALIDATE_MACValidates value as MAC address
32.FILTER_VALIDATE_REGEXPValidates value against a regular expression
33.FILTER_VALIDATE_URLValidates value as URL
34.FILTER_SANITIZE_EMAILRemoves all illegal characters from an email address
35.FILTER_SANITIZE_ENCODEDRemoves/Encodes special characters
36.FILTER_SANITIZE_MAGIC_QUOTESApply addslashes()
37.FILTER_SANITIZE_NUMBER_FLOATRemove all characters, except digits, +- signs, and optionally .,eE
38.FILTER_SANITIZE_NUMBER_INTRemoves all characters except digits and + – signs
39.FILTER_SANITIZE_SPECIAL_CHARSRemoves special characters
40.FILTER_SANITIZE_STRINGRemoves tags/special characters from a string
41.FILTER_SANITIZE_STRIPPEDAlias of FILTER_SANITIZE_STRING
42.FILTER_SANITIZE_URLRemoves all illegal characters from s URL
43.FILTER_UNSAFE_RAWDo nothing, optionally strip/encode special characters
44.FILTER_CALLBACKCall a user-defined function to filter data
45.INPUT_POSTPOST variables
46.INPUT_GETGET variables
47.INPUT_COOKIECOOKIE variables
48.INPUT_ENVENV variables
49.INPUT_SERVERSERVER variables

Mail Functions

The Mail function allows sending mail directly from script.

1.ezmlm_hash()Calculates the hash value by the EZMLM mailing list system.
2.mail()Allows you to send emails directly from a script.

FTP Functions

The FTP Functions give the client access to the file servers through the File Transfer Protocol(FTP). The FTP functions are used to open, login and close connections, upload, download, rename, delete and get information on files from file servers. 

1.ftp_alloc()Allocates space for a file to be uploaded to the FTP server.
2.ftp_cdup()Changes the current directory to the parent directory on the FTP server.
3.ftp_chdir()Changes the current directory on the FTP server
4.ftp_chmod()Sets the permissions on a file via FTP
5.ftp_close()Closes an FTP connection.
6.ftp_connect()Opens an FTP connection
7.ftp_delete()Deletes a file on the FTP server.
8.ftp_exec()Executes a program/command on the FTP server.
9.ftp_fget()Downloads a file from the FTP server and saves it to an open file.
10.ftp_fput()Uploads from an open file and saves it to a file on the FTP server.
11.ftp_get_option()Returns runtime behaviours of the FTP connection.
12.ftp_get()Downloads a file from the FTP server.
13.ftp_login()Logs on to an FTP connection
14.ftp_mdtm()Returns the last modified time of a specified file.
15.ftp_mkdir()Creates a new directory on the FTP server.
16.ftp_nb_continue()Continues retrieving/sending a file (non-blocking)
17.ftp_nb_fget()Downloads a file from the FTP server and saves it to an open file (non-blocking)
18.ftp_nb_fput()Uploads from an open file and saves it to a file on the FTP server (non-blocking)
19.ftp_nb_get()Downloads a file from the FTP server (non-blocking)
20.ftp_nb_put()Uploads a file to the FTP server (non-blocking)
21.ftp_nlist()Lists the files in a specified directory on the FTP server.
22.ftp_pasv()Turns passive mode on or off.
23.ftp_put()Uploads a file to the FTP server.
24.ftp_pwd()Returns the current directory name.
25.ftp_quit()Alias of ftp_close()
26.ftp_raw()Sends a raw command to the FTP server
27.ftp_rawlist()Returns a detailed list of files in the specified directory
28.ftp_rename()Renames a file or a directory on the FTP server.
29.ftp_rmdir()Removes a directory on the FTP server.
30.ftp_set_option()Sets runtime options for the FTP connection
31.ftp_site()Sends a SITE command to the server.
32.ftp_size()Returns the size of the specified file.
33.ftp_ssl_connect()Opens a secure SSL-FTP connection
34.ftp_systype()Returns the system type identifier of the FTP server.

FTP Constants

1.FTP_ASCII | FTP_TEXTIt is the FTP transfer mode. 
2.FTP_BINARY | FTP_IMAGEIt is the FTP transfer mode.
3.FTP_TIMEOUT_SECTimeout used for network operations
4.FTP_AUTOSEEKSets miscellaneous runtime FTP options.
5.FTP_AUTORESUMEAutomatically determine the resume position and start position for GET and PUT requests. FTP_AUTOSEEK needs to be enabled.
6.FTP_FAILEDAsynchronous transfer has failed.
7.FTP_FINISHEDAsynchronous transfer has completed.
8.FTP_MOREDATAAsynchronous transfer is in progress.

HTTP Functions

1.header()Sends a raw HTTP header to a client.
2.headers_list()Returns a list of response headers sent(or ready to send)
3.headers_sent()Checks if/where the HTTP headers have been sent.
4.setcookie()Sends an HTTP cookie to a client.
5.setrawcookie()Sends an HTTP cookie without URL encoding the cookie value.

Simple XML Functions

Allow us to easily manipulate and get XML Data. It gets an element’s name, attributes and textual content once the XML document’s structure or layout is known. Simple XML converts an XML document into a data structure that can be iterated through like arrays and objects.

1.__construct()Creates a new SimpleXML Element Object
2.addAttribute()Adds an attribute to the SimpleXML element
3.addChild()Adds a child element from the SimpleXML element.
4.asXML()Gets an XML string from a SimpleXML element.
5.attributes()Gets a SimpleXML element’s attributes.
6.children()Gets the children of a specified node.
7.getDocNamespaces()Gets the namespaces of an XML document.
8.getName()Gets the name of a SimpleXML element.
9.getNamespace()Gets the namespaces from XML data.
10.registerXPathNamespace()Creates a namespaces context for the next XPath query. 
11.simplexml_import_dom()Gets a SimpleXMLElement object from a DOM node.
12.simplexml_load_file()Gets a SimpleXMLElement object from an XML document.
13.simplexml_load_string()Gets a SimpleXMLElement  object from an XML string.
14.xpath()Runs an XPath query on XML data.

LIBXML Functions

These functions are used with SimpleXML, XSLT and DOM Functions. 

1.libxml_clear_errors()Clear libxml error buffer
2.libxml_get_errors()Retrieve array of errors
3.libxml_get_last_error()Retrieve last error from libxml
4.libxml_set_streams_context()Set the streams context for the next libxml document load or write.
5.libxml_use_internal_errors()Disable libxml errors and allow user to fetch error information as needed.

LIBXML Constants

1.LIBXML_BIGLINESMake line numbers greater than 65535 to be reported correctly
2.LIBXML_COMPACTSet small nodes allocation optimization. This may improve the application performance
3.LIBXML_DOTTED_VERSIONGet dotted libxml version (e.g. 2.6.5 or 2.6.17)
4.LIBXML_DTDATTRSet default DTD attributes
5.LIBXML_DTDLOADLoad external subset
6.LIBXML_DTDVALIDValidate with the DTD
7.LIBXML_ERR_ERRORGet recoverable errors
8.LIBXML_ERR_FATALGet fatal errors
9.LIBXML_ERR_NONEGet no errors
10.LIBXML_ERR_WARNINGGet simple warnings
11.LIBXML_HTML_NOIMPLIEDSet HTML_PARSE_NOIMPLIED flag. This turns off automatic adding of implied html/body elements
12.LIBXML_HTML_NODEFDTDSet HTML_PARSE_NODEFDTD flag. This prevents a default doctype to be added, if no doctype is found
13.LIBXML_NOBLANKSRemove blank nodes
14.LIBXML_NOCDATASet CDATA as text nodes
15.LIBXML_NOEMPTYTAGChange empty tags (e.g. <br/> to <br></br>), only available in the DOMDocument->save() and DOMDocument->saveXML() functions
16.LIBXML_NOENTSubstitute entities
17.LIBXML_NOERRORDo not show error reports
18.LIBXML_NONETStop network access while loading documents
19.LIBXML_NOWARNINGDo not show warning reports
20.LIBXML_NOXMLDECLDrop the XML declaration when saving a document
21.LIBXML_NSCLEANRemove excess namespace declarations
22.LIBXML_PARSEHUGESet XML_PARSE_HUGE flag. This relaxes any hardcoded limit from the parser, such as maximum depth of a document or the size of text nodes
23.LIBXML_PEDANTICSet XML_PARSE_PEDANTIC flag. This enables pedantic error reporting
24.LIBXML_XINCLUDEUse XInclude substitution
25.LIBXML_VERSIONGet libxml version (e.g. 20605 or 20617)
26.LIBXML_SCHEMA_CREATECreate default or fixed value nodes during XSD schema validation

XML Parser Functions

XML is a data format intended for standardized structured document exchange. They help to parse XML documents. They however do not help to validate the documents. The XML parser functions enables us to create XML parsers and define handlers for XML events.

1.utf8_decode()Decodes an UTF-8 string to ISO-8859-1
2.utf8_encode()Encodes an ISO-8859-1 string to UTF-8
3.xml_error_string()Gets an error string from the XML parser.
4.xml_get_current_byte_index()Gets the current byte index from the XML parser.
5.xml_get_current_column_number()Gets the current column number from the XML parser.
6.xml_get_current_line_number()Gets the current line number from the XML parser
7.xml_get_error_code()Gets an error code from the XML parser.
8.xml_parse()Parses an XML document.
9.xml_parse_into_struct()Parse XML data into an array.
10.xml_parser_create_ns()Create an XML parser with namespace support.
11.xml_parser_create()Create an XML parser
12.xml_parser_free()Free an XML parser
13.xml_parser_get_option()Get options from an XML parser
14.xml_parser_set_option()Set options in an XML parser
15.xml_set_character_data_handler()Set handler function for character data.
16.xml_set_default_handler()Set default handler function.
17.xml_set_element_handler()Set handler function for start and end of element of elements.
18.xml_set_end_namespace_decl_handler()Set handler function for the end of namespace declarations
19.xml_set_external_entity_ref_handler()Set handler functions for external entities.
20.xml_set_notation_decl_handler()Set handler function for notation declarations.
21.xml_set_object()Use XML Parser within an object.
22.xml_set_processing_instruction_handler()Set handler function for processing instruction.
23.xml_set_start_namespace_decl_handler()Set handler function for the start of namespace declarations
24.xml_set_unparsed_entity_decl_handler()Set handler function for unparsed entity declarations.

XML Parser Constants

1.XML_ERROR_NONE (integer)2.XML_ERROR_ASYNC_ENTITY (integer)
3.XML_ERROR_NO_MEMORY (integer)4.XML_ERROR_BAD_CHAR_REF (integer)
5.XML_ERROR_SYNTAX (integer)6.XML_ERROR_BINARY_ENTITY_REF (integer)
7.XML_ERROR_NO_ELEMENTS (integer)8.XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF (integer)
9.XML_ERROR_INVALID_TOKEN (integer)10.XML_ERROR_MISPLACED_XML_PI (integer)
11.XML_ERROR_UNCLOSED_TOKEN (integer)12.XML_ERROR_UNKNOWN_ENCODING (integer)
13.XML_ERROR_PARTIAL_CHAR (integer)14.XML_ERROR_INCORRECT_ENCODING (integer)
15.XML_ERROR_TAG_MISMATCH (integer)16.XML_ERROR_UNCLOSED_CDATA_SECTION (integer)
17.XML_ERROR_DUPLICATE_ATTRIBUTE (integer)18.XML_ERROR_EXTERNAL_ENTITY_HANDLING (integer)
19.XML_ERROR_JUNK_AFTER_DOC_ELEMENT (integer)20.XML_OPTION_CASE_FOLDING (integer)
21.XML_ERROR_PARAM_ENTITY_REF (integer)22.XML_OPTION_TARGET_ENCODING (integer)
23.XML_ERROR_UNDEFINED_ENTITY (integer)24.XML_OPTION_SKIP_TAGSTART (integer)
25.XML_ERROR_RECURSIVE_ENTITY_REF (integer)26.XML_OPTION_SKIP_WHITE (integer)

MYSQLI Functions

These functions allow you to access MySQL database servers. 

1.mysqli::$affected_rowsGets the number of affected rows in the previous MySQL operation
2.mysqli::autocommit()Turns on or off auto committing database modifications
3.mysqli::change_user()Changes the user of the specified database connection.
4.mysqli::character_set_name()Returns the default character set for the database connection
5.mysqli::$client_infoGet MySQL client info
6.mysqli::$client_versionReturns the MySQL client version as a string.
7.mysqli::close()Closes a previously opened database connection.
8.mysqli::commit()Commits the current transaction.
9.mysqli::$connect_errnoReturns the error code from the last connect call.
10.mysqli::$connect_errorReturns a string description of the last connect error.
11.mysqli::__construct()Open a new connection to the MySQL server.
12.mysqli::debug()Performs debugging operations.
13.mysqli::dump_debug_info()Dump debugging information into the log.
14.mysqli::$errnoReturns the error code for the most recent function call.
15.mysqli::$error_listReturns a list of errors from the last command executed.
16.mysqli::$errorReturns a string description of the last error.
17.mysqli::$field_countReturns the number of columns for the most recent query.
18.mysqli::get_charset()Returns a character set object.
19.mysqli::get_client_info()Get MySQL client info.
20.mysqli_get_client_stats()Returns client per-process statistics
21.mysqli_get_client_version()Returns the MySQL client version as a string.
22.mysqli::get_connection_stats()Returns statistics about the client connection
23.mysqli::$host_infoReturns a string representing the type of connection used.
24.mysqli::$protocol_versionReturns the version of the MySQL protocol used.
25.mysqli::$server_infoReturns the version of the MySQL Server.
26.mysqli::$server_versionReturns the version of the MySQL server as an integer.
27.mysqli::get_warnings()Get the result of “SHOW WARNINGS”.
28.mysqli::$infoRetrieves information about the most recently executed query.
29.mysqli::init()Initializes MYSQLi and returns a resource for use with mysqli_real connect()
30.mysqli::$insert_idReturns the auto generated id used in the last query.
31.mysqli::kill()Asks the server to kill a MySQL thread.
32.mysqli::more_results()Check if there are any more query results from a multi query.
33.mysqli::multi_query()Performs a query on a database.
34.mysqli::next_result()Prepare next result from a multi_query.
35.mysqli::options()Set options.
36.mysqli::ping()Pings a server connection, or tries to reconnect if the condition has gone down.
37.mysqli::poll()Poll connections.
38.mysqli::prepare()Prepare a SQL statement for execution.
39.mysqli::query()Performs a query on the database.
40.mysqli::real_connect()Opens a connection to a mysql server.
41.mysqli::real_escape_string()Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection.
42.mysqli::real_query()Execute a SQL query.
43.mysqli::reap_async_query()Get the result from async query.
44.mysqli::refresh()Refreshes
45.mysqli::rollback()Rolls back current transaction.
46.mysqli::rpl_query_type()Returns RPL query type.
47.mysqli::select_db()Selects the default database for database queries.
48.mysqli::send_query()Send the query and return.
49.mysqli::set_charset()Sets the default client character set.
50.mysqli::set_local_infile_default()Unsets user defined handler for load local infile command.
51.mysqli::set_local_infile_handler()Se callback function for LOAD DATA LOCAL INFILE command.
52.mysqli::$sqlstateReturns the SQLSTATE error from previous MySQL operation.
53.mysqli::ssl_set()Used for establishing secure connections using SSL
54.mysqli::stat()Gets the current system status.
55.mysqli::stmt_init()Initializes a statement and returns an object for use with mysqli_stmt prepare.
56.mysqli::store_result()Transfers a result set from the last query.
57.mysqli::$thread_idReturns the thread ID for the current connection.
58.mysqli::thread_safe()Returns whether thread safety is given or not.
59.mysqli::use_result()Initiate a result set retrieval.
60.mysqli::$warning_countReturns the number of warnings from the last query for the given link.

MYSQLI Statements Constants

1.mysqli_stmt::$affected_rowsReturns the total number of rows changed, deleted, or inserted by the last executed statement.
2.mysqli_stmt::attr_get()Used to get the current value of a statement attribute.
3.mysqli_stmt::attr_set()Used to modify the behaviour of a prepared statement.
4.mysqli_stmt::bind_param()Binds variables to a prepared statement as parameters.
5.mysqli_stmt::bind_result()Binds variables to a prepared statement for result storage.
6.mysqli_stmt::close()Closes a prepared statement.
7.mysqli_stmt::data_seek()Seeks to an arbitrary row in statement result set.
8.mysqli_stmt::$errnoReturns the error code for the most recent statement call.
9.mysqli_stmt::$error_listReturns a list of errors from the last statement executed.
10.mysqli_stmt::$errorReturns a string description for last statement error.
11.mysqli_stmt::execute()Executes a prepared query.
12.mysqli_stmt::fetch()Fetch results from a prepared statement into the bound variables.
13.mysqli_stmt::$field_countReturns the number of fields in the given statement.
14.mysqli_stmt::free_result()Frees stored result memory for the given statement handle.
15.mysqli_stmt::get_result()Gets a result from a prepared statement.
16.mysqli_stmt::get_warnings()Get result of SHOW WARNINGS
17.mysqli_stmt::$insert_idGet the ID generated from the previous insert operation.
18.mysqli_stmt::more_results()Check if there are any more query results from a multiple query.
19.mysqli_stmt::next_result()Reads the next result from a multiple query.
20.mysqli_stmt::$num_rowsReturn the number of rows in statements result set.
21.mysqli_stmt::$param_countReturns the number of parameters for the given statement.
22.mysqli_stmt::prepare()Prepares an SQL statement for execution.
23.mysqli_stmt::reset()Resets a prepared statement.
24.mysqli_stmt::result_metadata()Returns result set metadata from a prepared statement.
25.mysqli_stmt::send_long_data()Send data in blocks.
26.mysqli_stmt::$sqlstateReturns SQLSTATE error from previous statement operation.
27.mysqli_stmt::store_result()Transfers a result set from a prepared statement.

MYSQLI Result Class

1.mysqli_result::$current_fieldGet current field offset of a result pointer.
2.mysqli_result::data_seek()Adjusts the result pointer to an arbitrary row in the result.
3.mysqli_result::fetch_all()Fetches all result rows as an associative array, a numeric array, or both. 
4.mysqli_result::fetch_array()Fetch a result row as an associative, a numeric array, or both.
5.mysqli_result::fetch_assoc()Fetch a result row as an associative array.
6.mysqli_result::fetch_field_direct()Fetch meta-data for a single field.
7.mysqli_result::fetch_field()Returns the next field in the result set.
8.mysqli_result::fetch_fields()Returns an array of objects representing the fields in a result set.
9.mysqli_result::fetch_object()Returns the current row of a result se as an object.
10.mysqli_result::fetch_row()Get a result row as an enumerated array.
11.mysqli_result::$field_countGet the number of fields in a result.
12.mysqli_result::field_seek()Set result pointer to a specified field offset.
13.mysqli_result::free()Frees the memory associated with a result.
14.mysqli_result::$lengthsReturns the length of the column of the current row in the result set.
15.mysqli_result::$num_rowsGets the number of rows in a result.

MYSQLI Driver Class

1.mysqli_driver::embedded_server_end()Stop embedded server
2.mysqli_driver::embedded_server_start()Initialize and start embedded server
3.mysqli_driver::$report_modeEnables or disables internal report functions
4.mysqli_driver::$client_infoThe Clients API header version.
5.mysqli_driver::$client_versionThe Client Version
6.mysqli_driver::$driver_versionThe MySQLi Driver Version
7.mysqli_driver::$embeddedWhether MySQLi Embedded support is enabled.
8.mysqli_driver::$reconnectAllow or prevent reconnect 
9.mysqli_driver::$report_modeSet to MYSQLi_REPORT_OFF, MYSQLi_REPORT_ALL or any combination of MYSQLI_REPORT_STRICT (throw Exceptions for errors), MYSQLI_REPORT_ERROR (report errors) and MYSQLI_REPORT_INDEX (errors regarding indexes).

MYSQLI Warning Class

1.mysqli_warning::__construct()The _construct purpose
2.mysqli_warning::next()The next purpose
3.mysqli_warning::$messageMessage string
4.mysqli_warning::$sqlstateSQL State
5.mysqli_warning::$errnoThe MySQLi Driver Version

MYSQLi Constants

1.MYSQLI_READ_DEFAULT_GROUPRead options from the named group from my.cnf or the file specified with MYSQLI_READ_DEFAULT_FILE
2.MYSQLI_READ_DEFAULT_FILERead options from the named option file instead of from my.cnf
3.MYSQLI_OPT_CONNECT_TIMEOUTConnect timeout in seconds
4.MYSQLI_OPT_LOCAL_INFILEEnables command LOAD LOCAL INFILE
5.MYSQLI_INIT_COMMANDCommand to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.
6.MYSQLI_CLIENT_SSLUse SSL (encrypted protocol). This option should not be set by application programs; it is set internally in the MySQL client library
7.MYSQLI_CLIENT_COMPRESSUse compression protocol
8.MYSQLI_CLIENT_INTERACTIVEAllow interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. The client’s session wait_timeout variable will be set to the value of the session interactive_timeout variable.
9.MYSQLI_CLIENT_IGNORE_SPACEAllow spaces after function names. Makes all functions names reserved words.
10.MYSQLI_CLIENT_NO_SCHEMADon’t allow the db_name.tbl_name.col_name syntax.
11.MYSQLI_CLIENT_MULTI_QUERIESAllows multiple semicolon-delimited queries in a single mysqli_query() call.
12.MYSQLI_STORE_RESULTFor using buffered resultsets
13.MYSQLI_USE_RESULTFor using unbuffered result sets
14.MYSQLI_ASSOCColumns are returned into the array having the fieldname as the array index.
15.MYSQLI_NUMColumns are returned into the array having an enumerated index.
16.MYSQLI_BOTHColumns are returned into the array having both a numerical index and the fieldname as the associative index.
17.MYSQLI_NOT_NULL_FLAGIndicates that a field is defined as NOT NULL
18.MYSQLI_PRI_KEY_FLAGField is part of a primary index
19.MYSQLI_UNIQUE_KEY_FLAGField is part of a unique index.
20.MYSQLI_MULTIPLE_KEY_FLAGField is part of an index.
21.MYSQLI_BLOB_FLAGField is defined as BLOB
22.MYSQLI_UNSIGNED_FLAGField is defined as UNSIGNED
23.MYSQLI_ZEROFILL_FLAGField is defined as ZEROFILL
24.MYSQLI_AUTO_INCREMENT_FLAGField is defined as AUTO_INCREMENT
25.MYSQLI_TIMESTAMP_FLAGField is defined as TIMESTAMP
26.MYSQLI_SET_FLAGField is defined as SET
27.MYSQLI_NUM_FLAGField is defined as NUMERIC
28.MYSQLI_PART_KEY_FLAGField is part of an multi-index
29.MYSQLI_GROUP_FLAGField is part of GROUP BY
30.MYSQLI_TYPE_DECIMALField is defined as DECIMAL
31.MYSQLI_TYPE_NEWDECIMALPrecision math DECIMAL or NUMERIC field (MySQL 5.0.3 and up)
32.MYSQLI_TYPE_BITField is defined as BIT (MySQL 5.0.3 and up)
32.MYSQLI_TYPE_TINYField is defined as TINYINT
34.MYSQLI_TYPE_SHORTField is defined as SMALLINT
35.MYSQLI_TYPE_LONGField is defined as INT
36.MYSQLI_TYPE_FLOATField is defined as FLOAT
37.MYSQLI_TYPE_DOUBLEField is defined as DOUBLE
38.MYSQLI_TYPE_NULL 
39.MYSQLI_TYPE_TIMESTAMPField is defined as TIMESTAMP
40.MYSQLI_TYPE_LONGLONGField is defined as BIGINT
41.MYSQLI_TYPE_INT24Field is defined as MEDIUMINT
42.MYSQLI_TYPE_DATEField is defined as DATE
43.MYSQLI_TYPE_TIMEField is defined as TIME
44.MYSQLI_TYPE_DATETIMEField is defined as DATETIME
45.MYSQLI_TYPE_YEARField is defined as YEAR
46.MYSQLI_TYPE_NEWDATEField is defined as DATE
47.MYSQLI_TYPE_INTERVALField is defined as INTERVAL
48.MYSQLI_TYPE_ENUMField is defined as ENUM
49.MYSQLI_TYPE_SETField is defined as SET
50.MYSQLI_TYPE_TINY_BLOBField is defined as TINYBLOB
51.MYSQLI_TYPE_MEDIUM_BLOBField is defined as MEDIUMBLOB
52.MYSQLI_TYPE_LONG_BLOBField is defined as LONGBLOB
53.MYSQLI_TYPE_BLOBField is defined as BLOB
54.MYSQLI_TYPE_VAR_STRINGField is defined as VARCHAR
55.MYSQLI_TYPE_STRINGField is defined as CHAR or BINARY
56.MYSQLI_TYPE_CHARField is defined as TINYINT. For CHAR, see MYSQLI_TYPE_STRING
57.MYSQLI_TYPE_GEOMETRYField is defined as GEOMETRY
58.MYSQLI_NEED_DATAMore data available for bind variable
59.MYSQLI_NO_DATANo more data available for bind variable
60.MYSQLI_DATA_TRUNCATEDData truncation occurred. Available since PHP 5.1.0 and MySQL 5.0.5.
61.MYSQLI_ENUM_FLAGField is defined as ENUM. Available since PHP 5.3.0.
62.MYSQLI_REPORT_INDEXReport if no index or bad index was used in a query.
63.MYSQLI_REPORT_ERRORReport errors from mysqli function calls.
64.MYSQLI_REPORT_STRICTThrow a mysqli_sql_exception for errors instead of warnings.
65.MYSQLI_REPORT_ALLSet all options on (report all).
66.MYSQLI_REPORT_OFFTurns reporting off.
67.MYSQLI_DEBUG_TRACE_ENABLEDIs set to 1 if mysqli_debug() functionality is enabled.
68.MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED 
69.MYSQLI_SERVER_QUERY_NO_INDEX_USED 
70.MYSQLI_REFRESH_GRANTRefreshes the grant tables.
71.MYSQLI_REFRESH_LOGFlushes the logs, like executing the FLUSH LOGS SQL statement.
72.MYSQLI_REFRESH_TABLESFlushes the table cache, like executing the FLUSH TABLES SQL statement.
73.MYSQLI_REFRESH_HOSTSFlushes the host cache, like executing the FLUSH HOSTS SQL statement.
74.MYSQLI_REFRESH_STATUSReset the status variables, like executing the FLUSH STATUS SQL statement.
75.MYSQLI_REFRESH_THREADSFlushes the thread cache.
76.MYSQLI_REFRESH_SLAVEOn a slave replication server: resets the master server information, and restarts the slave. Like executing the RESET SLAVE SQL statement.
77.MYSQLI_REFRESH_MASTEROn a master replication server: removes the binary log files listed in the binary log index, and truncates the index file. Like executing the RESET MASTER SQL statement.

MISC Functions

All other categorized functions have been placed under this category. The behavior of these functions are affected by settings in the php.ini file. 

1.connection_aborted()Checks whether the client has disconnected.
2.connection_status()Returns the current connection status
3.connection_timeout()Deprecated since PHP 4.0.5
4.constant()Returns the value of a constant.
5.define()Defines a constant.
6.defined()Checks whether a constant exists.
7.die()Prints a message and exits the current script
8.eval()Evaluates a string as PHP Code 
9.exit()Prints a message and exits the current script.
10.get_browser()Returns the capabilities of the user’s browser
11.highlight_file()Outputs a file with the PHP syntax highlighted
12.highlight_string()Outputs a string with the PHP syntax highlighted.
13.ignore_user_abort()Sets whether a remote client can abort the running of a script.
14.pack()Packs data into a binary string
15.php_strip_whitespace()Removes the whitespaces and PHP Comments from the source code of a file.
16.show_source()Alias of highlight_file()
17.sleep()Delays code execution for a number of seconds.
18.time_nanosleep()Delays code execution for a number of seconds and nanoseconds.
19.time_sleep_until()Delays code execution until a specified time.
20.uniqid()Generates a unique ID
21.unpack()Unpacks data from a binary string.
22.usleep()Delays code execution for a number of microseconds.

MISC. Constants

1.CONNECTION_ABORTEDConnection is aborted by the user or network error.
2.CONNECTION_NORMALConnection is running normally.
3.CONNECTION_TIMEOUTConnection timed out.
4.__COMPILER_HALT_OFFSET__Determines the byte position of the data start.

Object-Oriented Programming

PHP codes can also be written in Object-Oriented Format. OOP is faster and easier to execute. The OOP structure makes the code easier to maintain, modify and debug. 

1.__construct()Classes with a constructor method call this method on each newly created object, so it is suitable for any initialization that the object may need before it is used. 
2.__destruct()Called as soon as there are no other references to a particular object, or in any order during the shutdown sequence.
3.__callStatic()Triggered when invoking inaccessible methods in a static context.
4.__call()Triggered when invoking inaccessible methods in an object context.
5.__get()Utilized for reading data from inaccessible properties.
6.__set()Run when writing data to inaccessible properties.
7.__isset()Triggered by calling isset() or empty() on inaccessible properties.
8.__unset()Invoked when unset() is used on inaccessible properties.
9.__sleep()The intended use of _sleep() is to commit pending data or perform similar cleanup tasks. Also, the function is useful if you have very large objects which do not need to be saved completely.
10.__wakeup()Used to re-establish database connections that may have been lost during serialization and perform other reinitialization tasks.
11.__toString()Allows a class to decide how it will react when it is treated like a string. 
12.__invoke()Called when a script tries to call an object as a function.
13.__set_state()Called for classes exported by var_export() since PHP 5.1.0
14.__clone()Once the cloning is complete, if a _clone() method is defined, then the newly created object’s _clone() method will be called, to allow any necessary properties that need to be changed.

Error Functions

These functions are used to handle errors and logging. The logging functions allow sending messages directly to other machines or systems while the error reporting functions allow customizing the level of error and feedback given. The behavior of the error functions are affected by the settings in the php.ini

1.debug_backtrace()Generates a backtrace
2.debug_print_backtrace()Prints a backtrace
3.error_get_last()Gets the last error occurred
4.error_log()Sends an error to a server error-log, to a file or to a remote destination.
5.error_reporting()Specifies which errors are reported.
6.restore_error_handler()Restores the previous error handler
7.restore_exception_handler()Restores the previous exception handler
8.set_error_handler()Sets a user defined function to handle errors.
9.set_exception_handler()Sets a user defined function to handle exceptions.
10.trigger_error()Creates a user-defined error message.
11.user_error()Alias of trigger error.

Error Constants

1.E_ERROR1Fatal run-time errors. Errors that cannot be recovered from. Execution of the script is halted
2.E_WARNING2Non-fatal run-time errors. Execution of the script is not halted
2.E_PARSE4Compile-time parse errors. Parse errors should only be generated by the parser
3.E_NOTICE8Run-time notices. The script found something that might be an error, but could also happen when running a script normally
4.E_CORE_ERROR16Fatal errors at PHP startup. This is like an E_ERROR in the PHP core
5.E_CORE_WARNING32Non-fatal errors at PHP startup. This is like an E_WARNING in the PHP core
6.E_COMPILE_ERROR64Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine
7.E_COMPILE_WARNING128Non-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine
8.E_USER_ERROR256Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()
9.E_USER_WARNING512Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()
10.E_USER_NOTICE1024User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()
11.E_STRICT2048Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code
12.E_RECOVERABLE_ERROR4096Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())
13.E_ALL6143All errors and warnings, except of level E_STRICT

Sourcehackr

Author

oDesk Software

Leave a comment