All PHP functions list

Browse the complete list of all PHP functions available on our site.

A

array_all() — The PHP array_all() function checks if all elements in an array satisfy a callback condition.
array_any() — The PHP array_any() function checks if at least one element in an array satisfies a callback condition.
array_change_key_case() — The PHP array_change_key_case() function returns an array with all keys from array changed to lowercase or uppercase.
array_chunk() — The PHP array_chunk() function splits an array into chunks.
array_column() — The PHP array_column() function returns the values from a single column in the input array.
array_combine() — The PHP array_combine() function creates an array by using one array for keys and another for values.
array_count_values() — The PHP array_count_values() function counts all the values of an array.
array_diff() — The PHP array_diff() function computes the difference of arrays using values only.
array_diff_assoc() — The PHP array_diff_assoc() function compares the values and keys of two (or more) arrays, and returns the differences.
array_diff_key() — The PHP array_diff_key() function compares the keys of two (or more) arrays, and returns the differences.
array_diff_uassoc() — The PHP array_diff_uassoc() function compares the values and keys of two (or more) arrays using a user-defined key comparison function, and returns the differences.
array_diff_ukey() — The PHP array_diff_ukey() function compares the keys of two (or more) arrays using a user-defined key comparison function, and returns the differences.
array_fill() — The PHP array_fill() function fills an array with values.
array_fill_keys() — The PHP array_fill_keys() function fills an array with values, using keys from another array.
array_filter() — The PHP array_filter() function filters array elements using a callback.
array_find() — The PHP array_find() function returns the first element that satisfies a given callback.
array_find_key() — The PHP array_find_key() function returns the key of the first element that satisfies a given callback.
array_flip() — The PHP array_flip() function swaps keys and values in an array.
array_intersect() — The PHP array_intersect() function computes the intersection of arrays using values.
array_intersect_assoc() — The PHP array_intersect_assoc() function compares the values and keys of two (or more) arrays, and returns the matches.
array_intersect_key() — The PHP array_intersect_key() function returns all elements from the first array whose keys are present in all other arrays.
array_intersect_uassoc() — The PHP array_intersect_uassoc() function computes the intersection of arrays with additional index check performed by a user-defined callback function.
array_intersect_ukey() — The PHP array_intersect_ukey() function computes the intersection of arrays using a user-defined callback to compare keys.
array_is_list() — The PHP array_is_list() function checks whether an array has sequential integer keys starting from 0 without gaps.
array_key_exists() — The PHP array_key_exists() function checks if a key exists in an array.
array_key_first() — The PHP array_key_first() function returns the first key of an array without modifying the internal pointer.
array_key_last() — The PHP array_key_last() function returns the last key of an array without modifying the internal pointer.
array_keys() — The PHP array_keys() function returns all the keys of an array.
array_map() — The PHP array_map() function applies a callback to each element of an array.
array_merge() — The PHP array_merge() function merges one or more arrays.
array_merge_recursive() — The PHP array_merge_recursive() function merges arrays recursively, combining values with the same keys.
array_multisort() — The PHP array_multisort() function sorts multiple arrays or multi-dimensional arrays at once.
array_pad() — The PHP array_pad() function pads an array to the specified length with a given value.
array_pop() — The PHP array_pop() function removes the last element of an array and returns it.
array_product() — The PHP array_product() function calculates the product of values in an array.
array_push() — The PHP array_push() function adds one or more elements to the end of an array.
array_rand() — The PHP array_rand() function picks one or more random keys from an array.
array_reduce() — The PHP array_reduce() function reduces an array to a single value.
array_replace() — The PHP array_replace() function replaces values from the first array with values from following arrays.
array_replace_recursive() — The PHP array_replace_recursive() function replaces values recursively in multi-dimensional arrays.
array_reverse() — The PHP array_reverse() function returns an array with elements in reverse order.
array_search() — The PHP array_search() function searches for a value in an array and returns the corresponding key.
array_shift() — The PHP array_shift() function removes the first element from an array and returns it. Numeric keys are reindexed.
array_slice() — The PHP array_slice() function extracts a portion of an array.
array_splice() — The PHP array_splice() function removes or replaces elements in an array.
array_sum() — The PHP array_sum() function calculates the sum of values in an array.
array_udiff() — The PHP array_udiff() function computes the difference of arrays using a user-defined comparison function for values.
array_udiff_assoc() — The PHP array_udiff_assoc() function computes the difference of arrays using a user-defined callback for value comparison and also checks keys.
array_udiff_uassoc() — The PHP array_udiff_uassoc() function computes the difference of arrays using user-defined callbacks for both value and key comparison.
array_uintersect() — The PHP array_uintersect() function computes the intersection of arrays using a user-defined comparison function for values.
array_uintersect_assoc() — The PHP array_uintersect_assoc() function computes the intersection of arrays with additional index check and uses a user-defined comparison function for values.
array_uintersect_uassoc() — The PHP array_uintersect_uassoc() function computes the intersection of arrays using user-defined callbacks for both value and key comparison.
array_unique() — The PHP array_unique() function removes duplicate values from an array.
array_unshift() — The PHP array_unshift() function prepends one or more elements to the beginning of an array.
array_values() — The PHP array_values() function returns all the values of an array and reindexes it.
array_walk() — The PHP array_walk() function applies a callback to each element of an array.
array_walk_recursive() — The PHP array_walk_recursive() function applies a callback to each element of an array recursively.
arsort() — The PHP arsort() function sorts an array in descending order while maintaining index association.

C

count() — The PHP count() function counts the number of elements in an array or Countable object.

I

in_array() — The PHP in_array() function checks if a value exists in an array.

S

sizeof() — The PHP sizeof() function is an alias of count() and returns the number of elements in an array or Countable object.

U

uasort() — The PHP uasort() function sorts an array by values while preserving keys.
uksort() — The PHP uksort() function sorts an array by keys using a custom comparison function.
usort() — The PHP usort() function sorts an array by values using a custom comparison function.

D

date_create() — The PHP date_create() function creates a DateTime object.
date_diff() — The PHP date_diff() function calculates the difference between two DateTime objects.
date_format() — The PHP date_format() function formats a DateTime object.

G

gmdate() — The PHP gmdate() function formats a date/time in UTC (GMT) instead of local timezone.

M

microtime() — The PHP microtime() function returns the current Unix timestamp with microseconds.
mktime() — The PHP mktime() function creates a Unix timestamp from date components.

S

strtotime() — The PHP strtotime() function parses an English textual datetime into a Unix timestamp.

T

time() — The PHP time() function returns the current Unix timestamp.

F

fclose() — The PHP fclose() function closes an open file handle.
file_exists() — The PHP file_exists() function checks whether a file or directory exists.
file_get_contents() — The PHP file_get_contents() function reads the entire file or URL into a string.
file_put_contents() — The PHP file_put_contents() function writes data to a file.
fopen() — The PHP fopen() function opens a file or URL and returns a file handle.
fread() — The PHP fread() function reads a specified number of bytes from an open file pointer.
fwrite() — The PHP fwrite() function writes data to an open file pointer.

I

is_dir() — The PHP is_dir() function checks whether a path is a directory.
is_file() — The PHP is_file() function checks whether a path is a regular file.

U

unlink() — The PHP unlink() function deletes a file.

B

base64_decode() — The PHP base64_decode() function decodes Base64-encoded data.
base64_encode() — The PHP base64_encode() function encodes binary data into Base64 representation.

J

json_decode() — The PHP json_decode() function decodes a JSON string into a PHP variable.
json_encode() — The PHP json_encode() function converts a value into a JSON string.

R

rawurldecode() — The PHP rawurldecode() function decodes a URL-encoded string encoded with rawurlencode().
rawurlencode() — The PHP rawurlencode() function encodes a string according to RFC 3986.

S

serialize() — The PHP serialize() function generates a storable representation of a value.

U

unserialize() — The PHP unserialize() function converts a serialized string back into a PHP value.
urldecode() — The PHP urldecode() function decodes URL-encoded strings.
urlencode() — The PHP urlencode() function encodes a string for use in a URL query.

A

abs() — The PHP abs() function returns the absolute value of a number.
acos() — The PHP acos() function returns the arc cosine of a number in radians.
acosh() — The PHP acosh() function returns the inverse hyperbolic cosine of a number.
apache_request_headers() — The PHP apache_request_headers() function fetches all HTTP request headers from the current request.
addcslashes() — The PHP addcslashes() function returns a string with backslashes before the characters that are listed in the characters parameter.
addslashes() — The PHP addslashes() function returns a string with backslashes before characters that need to be escaped.

E

explode() — The PHP explode() function splits a string into an array using a specified delimiter.

H

htmlentities() — The PHP htmlentities() function converts all applicable characters to HTML entities.
htmlspecialchars() — The PHP htmlspecialchars() function converts special characters to HTML entities.

I

implode() — The PHP implode() function joins array elements into a string using a specified separator.

L

lcfirst() — The PHP lcfirst() function makes the first character of a string lowercase.
ltrim() — The PHP ltrim() function removes whitespace or specified characters from the beginning of a string.

N

nl2br() — The PHP nl2br() function inserts HTML line breaks before all newlines in a string.

R

rtrim() — The PHP rtrim() function removes whitespace or specified characters from the end of a string.

S

str_contains() — The PHP str_contains() function checks if a string contains a given substring.
str_ends_with() — The PHP str_ends_with() function checks if a string ends with a given substring.
str_replace() — The PHP str_replace() function replaces all occurrences of a search string with a replacement string.
str_starts_with() — The PHP str_starts_with() function checks if a string starts with a given substring.
strcmp() — The PHP strcmp() function compares two strings in a case-sensitive manner.
strip_tags() — The PHP strip_tags() function removes HTML and PHP tags from a string.
strlen() — The PHP strlen() function returns the length of a string.
strncmp() — The PHP strncmp() function compares the first N characters of two strings.
strpos() — The PHP strpos() function is used to find the position of the first occurrence of a substring within a string.
strrpos() — The PHP strrpos() function finds the position of the last occurrence of a substring within a string.
strtolower() — The PHP strtolower() function converts a string to lowercase.
strtoupper() — The PHP strtoupper() function converts a string to uppercase.
substr() — The PHP substr() function returns a portion of a string.

T

trim() — The PHP trim() function removes whitespace (or other predefined characters) from the beginning and end of a string.

U

ucfirst() — The PHP ucfirst() function makes the first character of a string uppercase.
ucwords() — The PHP ucwords() function capitalizes the first character of each word in a string.

W

wordwrap() — The PHP wordwrap() function wraps a string to a given number of characters.

B

boolval() — The PHP boolval() function converts a value to boolean.

E

empty() — The PHP empty() construct checks whether a variable is empty.

F

floatval() — The PHP floatval() function converts a value to a floating-point number.

G

gettype() — The PHP gettype() function returns the type of a variable as a string.

I

intval() — The PHP intval() function converts a value to an integer.
is_array() — The PHP is_array() function checks whether a variable is an array.
is_bool() — The PHP is_bool() function checks whether a variable is of type boolean.
is_float() — The PHP is_float() function checks whether a variable is of type float.
is_int() — The PHP is_int() function checks whether a variable is of type integer.
is_null() — The PHP is_null() function checks whether a variable is null.
is_numeric() — The PHP is_numeric() function checks whether a variable is a number or numeric string.
is_object() — The PHP is_object() function checks whether a variable is an object.
is_string() — The PHP is_string() function checks whether a variable is of type string.
isset() — The PHP isset() construct checks whether a variable is set and not null.

S

settype() — The PHP settype() function sets the type of a variable.