OnlinePHP.io Functions


Find your function:


Arrays
  • array - Create an array
  • array_change_key_case - Changes the case of all keys in an array
  • array_chunk - Split an array into chunks
  • array_column - Return the values from a single column in the input array
  • array_combine - Creates an array by using one array for keys and another for its values
  • array_count_values - Counts all the values of an array
  • array_diff - Computes the difference of arrays
  • array_diff_assoc - Computes the difference of arrays with additional index check
  • array_diff_key - Computes the difference of arrays using keys for comparison
  • array_fill - Fill an array with values
  • array_fill_keys - Fill an array with values, specifying keys
  • array_flip - Exchanges all keys with their associated values in an array
  • array_intersect - Computes the intersection of arrays
  • array_intersect_assoc - Computes the intersection of arrays with additional index check
  • array_intersect_key - Computes the intersection of arrays using keys for comparison
  • array_is_list - Checks whether a given [array] is a list
  • array_key_exists - Checks if the given key or index exists in the array
  • array_key_first - Gets the first key of an array
  • array_key_last - Gets the last key of an array
  • array_keys - Return all the keys or a subset of the keys of an array
  • array_merge - Merge one or more arrays
  • array_merge_recursive - Merge one or more arrays recursively
  • array_multisort - Sort multiple or multi-dimensional arrays
  • array_pad - Pad array to the specified length with a value
  • array_pop - Pop the element off the end of array
  • array_product - Calculate the product of values in an array
  • array_push - Push one or more elements onto the end of array
  • array_rand - Pick one or more random keys out of an array
  • array_replace - Replaces elements from passed arrays into the first array
  • array_replace_recursive - Replaces elements from passed arrays into the first array recursively
  • array_reverse - Return an array with elements in reverse order
  • array_search - Searches the array for a given value and returns the first corresponding key if successful
  • array_shift - Shift an element off the beginning of array
  • array_slice - Extract a slice of the array
  • array_splice - Remove a portion of the array and replace it with something else
  • array_sum - Calculate the sum of values in an array
  • array_unique - Removes duplicate values from an array
  • array_unshift - Prepend one or more elements to the beginning of an array
  • array_values - Return all the values of an array
  • arsort - Sort an array in descending order and maintain index association
  • asort - Sort an array in ascending order and maintain index association
  • count - Counts all elements in an array or in a Countable object
  • in_array - Checks if a value exists in an array
  • krsort - Sort an array by key in descending order
  • ksort - Sort an array by key in ascending order
  • natcasesort - Sort an array using a case insensitive "natural order" algorithm
  • natsort - Sort an array using a "natural order" algorithm
  • range - Create an array containing a range of elements
  • rsort - Sort an array in descending order
  • sort - Sort an array in ascending order

BCMath
  • bcadd - Add two arbitrary precision numbers
  • bccomp - Compare two arbitrary precision numbers
  • bcdiv - Divide two arbitrary precision numbers
  • bcmod - Get modulus of an arbitrary precision number
  • bcmul - Multiply two arbitrary precision numbers
  • bcpow - Raise an arbitrary precision number to another
  • bcpowmod - Raise an arbitrary precision number to another, reduced by a specified modulus
  • bcscale - Set or get default scale parameter for all bc math functions
  • bcsqrt - Get the square root of an arbitrary precision number
  • bcsub - Subtract one arbitrary precision number from another

Calendar
  • cal_days_in_month - Return the number of days in a month for a given year and calendar
  • cal_from_jd - Converts from Julian Day Count to a supported calendar
  • cal_info - Returns information about a particular calendar
  • cal_to_jd - Converts from a supported calendar to Julian Day Count
  • easter_date - Get Unix timestamp for midnight on Easter of a given year
  • easter_days - Get number of days after March 21 on which Easter falls for a given year
  • frenchtojd - Converts a date from the French Republican Calendar to a Julian Day Count
  • gregoriantojd - Converts a Gregorian date to Julian Day Count
  • jddayofweek - Returns the day of the week
  • jdmonthname - Returns a month name
  • jdtofrench - Converts a Julian Day Count to the French Republican Calendar
  • jdtogregorian - Converts Julian Day Count to Gregorian date
  • jdtojewish - Converts a Julian day count to a Jewish calendar date
  • jdtojulian - Converts a Julian Day Count to a Julian Calendar Date
  • jdtounix - Convert Julian Day to Unix timestamp
  • jewishtojd - Converts a date in the Jewish Calendar to Julian Day Count
  • juliantojd - Converts a Julian Calendar date to Julian Day Count
  • unixtojd - Convert Unix timestamp to Julian Day

Cryptography and Hashing
  • hash - Generate a hash value (message digest)
  • hash_algos - Return a list of registered hashing algorithms
  • hash_equals - Timing attack safe string comparison
  • hash_hkdf - Generate a HKDF key derivation of a supplied key input
  • hash_hmac - Generate a keyed hash value using the HMAC method
  • hash_hmac_algos - Return a list of registered hashing algorithms suitable for hash_hmac
  • hash_pbkdf2 - Generate a PBKDF2 key derivation of a supplied password
  • random_bytes - Generates cryptographically secure pseudo-random bytes
  • random_int - Generates cryptographically secure pseudo-random integers

Custom tools

Date and Time
  • checkdate - Validate a Gregorian date
  • date - Format a local time/date
  • getdate - Get date/time information
  • gettimeofday - Get current time
  • gmdate - Format a GMT/UTC date/time
  • gmmktime - Get Unix timestamp for a GMT date
  • gmstrftime - Format a GMT/UTC time/date according to locale settings
  • hrtime - Get the system's high resolution time
  • idate - Format a local time/date as integer
  • localtime - Get the local time
  • microtime - Return current Unix timestamp with microseconds
  • mktime - Get Unix timestamp for a date
  • strftime - Format a local time/date according to locale settings
  • strptime - Parse a time/date generated with strftime
  • strtotime - Parse about any English textual datetime description into a Unix timestamp
  • time - Return current Unix timestamp

Filesystem

General
  • hex2bin - Decodes a hexadecimally encoded binary string
  • json_decode - Decodes a JSON string
  • json_encode - Returns the JSON representation of a value
  • pack - Pack data into binary string
  • serialize - Generates a storable representation of a value
  • token_name - Get the symbolic name of a given PHP token
  • uniqid - Generate a unique ID
  • unpack - Unpack data from binary string
  • unserialize - Creates a PHP value from a stored representation
  • zlib_decode - Uncompress any raw/gzip/zlib encoded data
  • zlib_encode - Compress data with the specified encoding

iconv

Language and Character Encoding
  • idn_to_ascii - Convert domain name to IDNA ASCII form
  • idn_to_utf8 - Convert domain name from IDNA ASCII to Unicode

Math
  • abs - Absolute value
  • acos - Arc cosine
  • acosh - Inverse hyperbolic cosine
  • asin - Arc sine
  • asinh - Inverse hyperbolic sine
  • atan - Arc tangent
  • atan2 - Arc tangent of two variables
  • atanh - Inverse hyperbolic tangent
  • base_convert - Convert a number between arbitrary bases
  • bindec - Binary to decimal
  • ceil - Round fractions up
  • cos - Cosine
  • cosh - Hyperbolic cosine
  • decbin - Decimal to binary
  • dechex - Decimal to hexadecimal
  • decoct - Decimal to octal
  • deg2rad - Converts the number in degrees to the radian equivalent
  • exp - Calculates the exponent of e
  • expm1 - Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
  • fdiv - Divides two numbers, according to IEEE 754
  • floor - Round fractions down
  • fmod - Returns the floating point remainder (modulo) of the division of the arguments
  • getrandmax - Show largest possible random value
  • hexdec - Hexadecimal to decimal
  • hypot - Calculate the length of the hypotenuse of a right-angle triangle
  • intdiv - Integer division
  • is_finite - Finds whether a value is a legal finite number
  • is_infinite - Finds whether a value is infinite
  • is_nan - Finds whether a value is not a number
  • lcg_value - Combined linear congruential generator
  • log - Natural logarithm
  • log10 - Base-10 logarithm
  • log1p - Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
  • max - Find highest value
  • min - Find lowest value
  • mt_getrandmax - Show largest possible random value
  • mt_rand - Generate a random value via the Mersenne Twister Random Number Generator
  • mt_srand - Seeds the Mersenne Twister Random Number Generator
  • octdec - Octal to decimal
  • pi - Get value of pi
  • pow - Exponential expression
  • rad2deg - Converts the radian number to the equivalent number in degrees
  • rand - Generate a random integer
  • round - Rounds a float
  • sin - Sine
  • sinh - Hyperbolic sine
  • sqrt - Square root
  • srand - Seed the random number generator
  • tan - Tangent
  • tanh - Hyperbolic tangent

Multibyte String

Network
  • gethostbyaddr - Get the Internet host name corresponding to a given IP address
  • gethostbyname - Get the IPv4 address corresponding to a given Internet host name
  • gethostbynamel - Get a list of IPv4 addresses corresponding to a given Internet host name
  • getmxrr - Get MX records corresponding to a given Internet host name
  • getservbyname - Get port number associated with an Internet service and protocol
  • getservbyport - Get Internet service which corresponds to port and protocol
  • ip2long - Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer
  • long2ip - Converts an long integer address into a string in (IPv4) Internet standard dotted format

Output Buffering

Password Hashing

Regular Expressions

String Manipulation
  • addcslashes - Quote string with slashes in a C style
  • addslashes - Quote string with slashes
  • bin2hex - Convert binary data into hexadecimal representation
  • chr - Generate a single-byte string from a number
  • chunk_split - Split a string into smaller chunks
  • convert_cyr_string - Convert from one Cyrillic character set to another
  • convert_uudecode - Decode a uuencoded string
  • convert_uuencode - Uuencode a string
  • count_chars - Return information about characters used in a string
  • crc32 - Calculates the crc32 polynomial of a string
  • crypt - One-way string hashing
  • explode - Split a string by a string
  • get_html_translation_table - Returns the translation table used by htmlspecialchars and htmlentities
  • hebrev - Convert logical Hebrew text to visual text
  • hebrevc - Convert logical Hebrew text to visual text with newline conversion
  • html_entity_decode - Convert HTML entities to their corresponding characters
  • htmlentities - Convert all applicable characters to HTML entities
  • htmlspecialchars - Convert special characters to HTML entities
  • htmlspecialchars_decode - Convert special HTML entities back to characters
  • iconv - Convert a string from one character encoding to another
  • implode - Join array elements with a string
  • lcfirst - Make a string's first character lowercase
  • levenshtein - Calculate Levenshtein distance between two strings
  • localeconv - Get numeric formatting information
  • ltrim - Strip whitespace (or other characters) from the beginning of a string
  • md5 - Calculate the md5 hash of a string
  • md5_file - Calculates the md5 hash of a given file
  • metaphone - Calculate the metaphone key of a string
  • money_format - Formats a number as a currency string
  • nl_langinfo - Query language and locale information
  • nl2br - Inserts HTML line breaks before all newlines in a string
  • number_format - Format a number with grouped thousands
  • ord - Convert the first byte of a string to a value between 0 and 255
  • parse_str - Parses the string into variables
  • print - Output a string
  • printf - Output a formatted string
  • quoted_printable_decode - Convert a quoted-printable string to an 8 bit string
  • quoted_printable_encode - Convert a 8 bit string to a quoted-printable string
  • quotemeta - Quote meta characters
  • rtrim - Strip whitespace (or other characters) from the end of a string
  • sha1 - Calculate the sha1 hash of a string
  • sha1_file - Calculate the sha1 hash of a file
  • similar_text - Calculate the similarity between two strings
  • soundex - Calculate the soundex key of a string
  • sprintf - Return a formatted string
  • sscanf - Parses input from a string according to a format
  • str_contains - Determine if a string contains a given substring
  • str_ends_with - Checks if a string ends with a given substring
  • str_getcsv - Parse a CSV string into an array
  • str_ireplace - Case-insensitive version of str_replace
  • str_pad - Pad a string to a certain length with another string
  • str_repeat - Repeat a string
  • str_replace - Replace all occurrences of the search string with the replacement string
  • str_rot13 - Perform the rot13 transform on a string
  • str_shuffle - Randomly shuffles a string
  • str_split - Convert a string to an array
  • str_starts_with - Checks if a string starts with a given substring
  • str_word_count - Return information about words used in a string
  • strcasecmp - Binary safe case-insensitive string comparison
  • strcmp - Binary safe string comparison
  • strcoll - Locale based string comparison
  • strcspn - Find length of initial segment not matching mask
  • strip_tags - Strip HTML and PHP tags from a string
  • stripcslashes - Un-quote string quoted with addcslashes
  • stripos - Find the position of the first occurrence of a case-insensitive substring in a string
  • stripslashes - Un-quotes a quoted string
  • stristr - Case-insensitive strstr
  • strlen - Get string length
  • strnatcasecmp - Case insensitive string comparisons using a "natural order" algorithm
  • strnatcmp - String comparisons using a "natural order" algorithm
  • strncasecmp - Binary safe case-insensitive string comparison of the first n characters
  • strncmp - Binary safe string comparison of the first n characters
  • strpbrk - Search a string for any of a set of characters
  • strpos - Find the position of the first occurrence of a substring in a string
  • strrchr - Find the last occurrence of a character in a string
  • strrev - Reverse a string
  • strripos - Find the position of the last occurrence of a case-insensitive substring in a string
  • strrpos - Find the position of the last occurrence of a substring in a string
  • strspn - Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask
  • strstr - Find the first occurrence of a string
  • strtok - Tokenize string
  • strtolower - Make a string lowercase
  • strtoupper - Make a string uppercase
  • strtr - Translate characters or replace substrings
  • strval - Get string value of a variable
  • substr - Return part of a string
  • substr_compare - Binary safe comparison of two strings from an offset, up to length characters
  • substr_count - Count the number of substring occurrences
  • substr_replace - Replace text within a portion of a string
  • trim - Strip whitespace (or other characters) from the beginning and end of a string
  • ucfirst - Make a string's first character uppercase
  • ucwords - Uppercase the first character of each word in a string
  • utf8_decode - Converts a string from UTF-8 to ISO-8859-1, replacing invalid or unrepresentable characters
  • utf8_encode - Converts a string from ISO-8859-1 to UTF-8
  • vprintf - Output a formatted string
  • vsprintf - Return a formatted string
  • wordwrap - Wraps a string to a given number of characters

Urls

PHP Documentation

Online tool Categories

Last used PHP functions

Most used PHP functions