Home >Backend Development >PHP Tutorial >Comprehensive list of commonly used functions in PHP_PHP tutorial
The php usleep() function delays code execution for a number of microseconds.
The unpack() function unpacks data from a binary string.
The uniqid() function generates a unique ID based on the current time in microseconds.
The time_sleep_until() function delays code execution until a specified time.
The time_nanosleep() function delays code execution for a number of seconds and nanoseconds.
The sleep() function delays code execution for a number of seconds.
The show_source() function performs syntax highlighting on files.
The strip_whitespace() function returns the source code file with PHP comments and whitespace characters removed.
The pack() function loads data into a binary string.
The ignore_user_abort() function sets whether disconnecting from the client will terminate the execution of the script.
The highlight_string() function performs syntax highlighting on strings.
The highlight_file() function performs syntax highlighting on files.
The get_browser() function returns the performance of the user's browser.
The exit() function outputs a message and exits the current script.
The eval() function evaluates a string according to PHP code.
The die() function outputs a message and exits the current script.
The defined() function checks whether a constant exists.
The define() function defines a constant.
The constant() function returns the value of a constant.
The connection_status() function returns the current connection status.
The connection_aborted() function checks whether the client is disconnected.
The zip_read() function reads the next file in an open zip archive.
The zip_open() function opens a ZIP file for reading.
The zip_entry_read() function gets the contents from an open zip archive entry.
The zip_entry_open() function opens a ZIP archive entry for reading.
The zip_entry_name() function returns the name of the zip archive entry.
The zip_entry_filesize() function returns the original size of the zip archive entry (before compression).
The zip_entry_compressionmethod() function returns the compression method of the zip archive entry.
The zip_entry_compressedsize() function returns the compressed file size of the zip archive entry.
The zip_entry_close() function closes a zip archive file opened by the zip_entry_open() function.
The zip_close() function closes a zip archive file opened by the zip_open() function.
The xml_set_unparsed_entity_decl_handler() function specifies the function to be called when an unresolved entity name (NDATA) declaration is encountered.
The xml_set_processing_instruction_handler() function specifies the function to be called when the parser finds a processing instruction in the XML document.
The xml_set_object() function allows the use of XML parsers within objects.
The xml_set_notation_decl_handler() function specifies the function that is called when the parser finds a symbol declaration in the XML document.
The xml_set_external_entity_ref_handler() function specifies the function that is called when the parser finds an external entity in the XML document.
The xml_set_element_handler() function establishes the starting and ending element handlers.
The xml_set_default_handler() function establishes the default data handler for the XML parser.
The xml_set_character_data_handler() function creates a character data handler.
The xml_parser_set_option() function sets options for the XML parser.
The xml_parser_get_option() function obtains option setting information from the XML parser.
The xml_parser_free() function frees the XML parser.
The xml_parser_create() function creates an XML parser.
The xml_parser_create_ns() function creates an XML parser with namespace support.
The xml_parse_into_struct() function parses XML data into an array.
The xml_parse() function parses an XML document.
The xml_get_error_code() function gets the XML parser error code.
The xml_get_current_line_number() function gets the current line number of the XML parser.
The xml_get_current_column_number() function gets the current column number of the XML parser.
The xml_get_current_byte_index() function gets the current byte index of the XML parser.
The xml_error_string() function gets the XML parser error description.
The utf8_encode() function encodes ISO-8859-1 strings to UTF-8.
The utf8_decode() function decodes a UTF-8 string to ISO-8859-1.
The wordwrap() function wraps a string according to the specified length.
The vsprintf() function writes the formatted string into a variable.
The vprintf() function outputs a formatted string.
The vfprintf() function writes a formatted string to the specified output stream.
The ucwords() function converts the first character of each word in a string to uppercase.
The ucfirst() function converts the first character in a string to uppercase.
The trim() function removes whitespace characters and other predefined characters from both ends of a string.
The substr_replace() function replaces part of a string with another string.
The substr_count() function counts the number of times a substring appears in a string.
The substr_compare() function compares two strings starting at a specified starting length.
The substr() function returns a portion of a string.
The strtr() function converts specific characters in a string.
The strtoupper() function converts a string to uppercase.
The strtolower() function converts a string to lowercase.
The strtok() function splits a string into smaller strings.
The strstr() function searches for the first occurrence of one string within another string.
The strspn() function returns the number of specific characters contained in a string.
The strrpos() function finds the last occurrence of a string within another string.
The strripos() function finds the last occurrence of a string within another string.
The strrev() function reverses a string.
The strrchr() function finds the last occurrence of a string within another string and returns all characters from that position to the end of the string.
The strpos() function returns the position of the first occurrence of a string within another string.
The strpbrk() function searches a string for any one of the specified characters.
The strncmp() function compares two strings.
The strncasecmp() function compares two strings.
The strnatcmp() function uses a "natural" algorithm to compare two strings.
The strnatcasecmp() function uses a "natural" algorithm to compare two strings.
The strlen() function returns the length of a string.
The stristr() function finds the first occurrence of a string within another string.
The stripos() function returns the position of the first occurrence of a string within another string.
The stripslashes() function removes backslashes added by the addslashes() function.
The stripcslashes() function removes backslashes added by the addcslashes() function.
The strip_tags() function strips HTML, XML, and PHP tags.
The strcspn() function returns the number of characters searched in a string before any specified character is found.
The strcoll() function compares two strings.
The strcmp() function compares two strings.
The strchr() function searches for the first occurrence of a string within another string.
The strcasecmp() function compares two strings.
The str_word_count() function counts the number of words in a string.
The str_split() function splits a string into an array.
The str_shuffle() function randomly shuffles all characters in a string.
The str_rot13() function performs ROT13 encoding of a string.
The str_replace() function uses one string to replace other characters in a string.
The str_repeat() function repeats a string a specified number of times.
The str_pad() function pads a string to the specified length.
The str_ireplace() function uses one string to replace other characters in a string.
The sscanf() function parses input from a string according to a specified format.
The sprintf() function writes a formatted string into a variable.
The soundex() function calculates the soundex keys of a string.
The similar_text() function counts the number of matching characters between two strings.
The sha1_file() function calculates the SHA-1 hash of a file.
The sha1() function computes the SHA-1 hash of a string.
The setlocale() function sets regional information (regional information).
rtrim() P rtrim() function
PHP String function
The quotemeta() function adds a backslash before certain predefined characters in a string.
The quoted_printable_decode() function decodes the quoted-printable encoded string and returns an 8-bit string.
The printf() function outputs a formatted string.
The print() function outputs one or more strings.
The parse_str() function parses the query string into variables.
The ord() function returns the ASCII value of the first character of a string.
The number_format() function formats a number by grouping by thousands.
The nl2br() function inserts an HTML newline character (
) before each new line (n) in a string.
The nl_langinfo() function returns the specified local information.
The money_format() function formats a string into a currency string.
The metaphone() function calculates the metaphone key of a string.
The md5_file() function calculates the MD5 hash of a file.
The md5() function calculates the MD5 hash of a string.
The ltrim() function removes spaces or other predefined characters from the left side of a string.
The localeconv() function returns an array containing local number and currency information formats.
The levenshtein() function returns the Levenshtein distance between two strings.
The join() function combines array elements into a string.
The implode() function combines array elements into a string.
The htmlspecialchars() function converts some predefined characters into HTML entities.
html_entity_decode() chars_decode() function
PHP String Function
The htmlentities() function converts characters into HTML entities.
The html_entity_decode() function converts HTML entities into characters.
The hebrevc() function converts Hebrew text from right-to-left flow to left-to-right flow. It also converts newlines (n) to
.
The hebrev() function converts Hebrew text from right-to-left flow to left-to-right flow.
The get_html_translation_table() function returns the translation table used by the htmlentities() and htmlspecialchars() functions.
The fprintf() function writes a formatted string to the specified output stream (for example: file or database).
The explode() function splits a string into an array.
The echo() function outputs one or more strings.
The crypt() function returns a string encrypted using DES, Blowfish, or MD5.
The crc32() function computes the crc32 polynomial of a string.
The count_chars() function returns information about the characters used in a string.
The convert_uuencode() function encodes a string using the uuencode algorithm.
The convert_uudecode() function decodes a uuencode-encoded string.
The convert_cyr_string() function converts characters from one Cyrillic character to another.
The chunk_split() function splits a string into a series of smaller parts.
The chr() function returns a character from a specified ASCII value.
The chop() function removes whitespace characters or other predefined characters starting from the end of a string.
The bin2hex() function converts a string of ASCII characters to a hexadecimal value.
The addslashes() function adds a backslash before the specified predefined characters.
The addcslashes() function adds a backslash before the specified character.
The xpath() function runs an XPath query on an XML document.
The simplexml_load_string() function loads an XML string into an object.
The simplexml_load_file() function loads an XML document into an object.
The simplexml_import_dom() function converts DOM nodes into SimpleXMLElement objects.
The registerXPathNamespace() function creates a namespace context for the next XPath query.
The getNamespace() function gets the namespace used in the XML document.
The getName() function gets the name of an XML element from a SimpleXMLElement object.
The getDocNamespaces() function returns the namespaces declared in the XML document from a SimpleXMLElement object.
The children() function gets the child nodes of the specified node.
The attributes() function gets the attributes of a SimpleXML element.
The asXML() function returns an XML document from a SimpleXMLElement object as a string.
The addChild() function adds a child node to the specified XML node.
The addAttribute() function adds an attribute to a SimpleXML element.
The __construct() function creates a new SimpleXMLElement object.
The mysql_unbuffered_query() function sends a SQL query to MySQL (without getting/caching the results).
The mysql_thread_id() function returns the ID of the current thread.
The mysql_stat() function returns the current system status of the MySQL server.
The mysql_select_db() function sets the active MySQL database.
The mysql_result() function returns the value of a field in the result set.
The mysql_real_escape_string() function escapes special characters in strings used in SQL statements.
The mysql_query() function executes a MySQL query.
mysql_ping() function Pings a server connection, or reconnects if there is no connection.
The mysql_pconnect() function opens a persistent connection to the MySQL server.
The mysql_num_rows() function returns the number of rows in the result set.
The mysql_num_fields() function returns the number of fields in the result set.
The mysql_list_processes() function lists MySQL processes.
The mysql_list_dbs() function lists all databases in the MySQL server.
The mysql_insert_id() function returns the ID generated by the previous INSERT operation.
The mysql_info() function returns information about the most recent query.
The mysql_get_server_info() function returns information about the MySQL server.
The mysql_get_proto_info() function returns MySQL protocol information.
The mysql_get_host_info() function returns information about the MySQL host.
The mysql_get_client_info() function returns MySQL client information.
The mysql_free_result() function frees the result memory.
The mysql_field_type() function returns the type of the specified field in the result set.
The mysql_field_table() function returns the table name where the specified field is located.
The mysql_field_seek() function sets the pointer in the result set to the specified field offset.
The mysql_field_name() function obtains the field name of the specified field in the result.
The mysql_field_len() function returns the length of the specified field.
The mysql_field_flags() function obtains the flags associated with the specified field from the result.
The mysql_fetch_row() function fetches a row from the result set as a numeric array.
The mysql_fetch_object() function fetches a row as an object from the result set (record set).
The mysql_fetch_lengths() function obtains the length of the contents of each field in a row.
The mysql_fetch_field() function obtains column information from the result set and returns it as an object.
The mysql_fetch_assoc() function fetches a row from the result set as an associative array.
The mysql_fetch_array() function fetches a row from the result set as an associative array, a numeric array, or both
The mysql_error() function returns the text error message generated by the previous MySQL operation.
The mysql_errno() function returns the numeric code of the error message in the previous MySQL operation.
The mysql_db_name() function obtains the database name returned by the mysql_list_dbs() call.
The mysql_data_seek() function moves the internal result pointer.
The mysql_connect() function opens a non-persistent MySQL connection.
The mysql_close() function closes non-persistent MySQL connections.
The mysql_client_encoding() function returns the name of the character set for the current connection.
The mysql_affected_rows() function returns the number of rows affected by the previous MySQL operation.
The tanh() function returns the hyperbolic tangent.
The tan() function returns the tangent.
The srand() function seeds a random number generator.
The sqrt() function returns the square root of a number.
The sinh() function returns the hyperbolic sine of a number.
The sin() function returns the sine of a number.
The round() function rounds floating point numbers.
The rand() function returns a random integer.
The rad2deg() function converts radians to degrees.
The pow() function returns x raised to the y power.
The pi() function returns the value of pi.
The octdec() function converts octal to decimal.
mt_srand() seeds a Mersenne Twister random number generator.
mt_rand() returns a random integer using the Mersenne Twister algorithm.
mt_getrandmax() displays the maximum possible value of a random number.
min() returns the minimum value.
max() returns the maximum value.
log1p() to return log(1 + x), which can be calculated accurately even when the value of x is close to zero.
log10() Base 10 logarithm.
log() returns the natural logarithm.
lcg_value() combines linear congruential generators.
is_nan() determines whether it is a legal value.
is_infinite() determines whether it is infinite.
The is_finite() function determines whether it is a finite value.
The hypot() function calculates the length of the hypotenuse of a right triangle.
The hexdec() function converts hexadecimal to decimal.
The fmod() function displays the largest possible value of a random number.
The fmod() function returns the floating point remainder of division.
The floor() function rounds down to the nearest integer.
The expm1() function returns exp(x) - 1, which is accurate even when number approaches zero.
The exp() function calculates the exponent of e.
The deg2rad() function converts angles to radians.
The decoct() function converts decimal to octal.
The dechex() function converts decimal to hexadecimal.
The decbin() function converts decimal to binary.
The cosh() function returns the hyperbolic cosine of a number.
The cos() function returns the cosine of a number.
The ceil() function rounds up to the nearest integer.
The bindec() function converts binary to decimal.
The base_convert() function converts numbers between arbitrary bases.
The atanh() function returns the inverse hyperbolic tangent of an angle.
atan() and atan2() and atan2() functions
PHP Math function
atan() and atan2() and atan2() functions
PHP Math function
The asinh() function returns the inverse hyperbolic sine of a number.
The asin() function returns the arcsine of different values, returning a value in radians between -PI/2 and PI/2.
The acosh() function returns the inverse hyperbolic cosine of a number.
The acos() function returns the arc cosine of a number.
The abs() function returns the absolute value of a number.
The mail() function allows you to send an email directly from a script.
The libxml_use_internal_errors() function disables standard libxml errors and enables user error handling.
The libxml_get_last_error() function gets the last error from the libxml error buffer.
The libxml_get_errors() function gets errors from the libxml error buffer.
The libxml_clear_errors() function clears the libxml error buffer.
The setrawcookie() function sends an HTTP cookie without URL encoding the cookie value.
The setcookie() function sends an HTTP cookie to the client.
The headers_sent() function checks if/where HTTP headers were sent.
The headers_list() function returns a list of sent (or pending) response headers.
The header() function sends raw HTTP headers to the client.
The ftp_systype() function returns the system type identifier of the remote FTP server.
The ftp_ssl_connect() function opens a secure SSL-FTP connection.
The ftp_size() function returns the size of the specified file.
The ftp_site() function sends the SITE command to the server.
The ftp_set_option() function sets various FTP runtime options.
The ftp_rmdir() function deletes a directory.
The ftp_rename() function changes the file or directory name on the FTP server.
The ftp_rawlist() function returns a detailed listing of the files in the specified directory.
The ftp_raw() function sends a raw command to the FTP server.
The ftp_quit() function closes the FTP connection.
The ftp_pwd() function returns the current directory name.
The ftp_put() function uploads files to the server.
The ftp_pasv() function sets passive mode on or off.
The ftp_nlist() function returns the file list of the specified directory.
The ftp_nb_put() function uploads files to the server (non-blocking).
The ftp_nb_get() function gets a file from an FTP server and writes it to a local file (non-blocking).
The ftp_nb_fput() function uploads an open file and saves it as a file on the FTP server (non-blocking).
The ftp_nb_fget() function downloads a file from the FTP server and saves it to a file that has been opened locally (non-blocking).
The ftp_nb_continue() function continuously gets/sends files.
The ftp_mkdir() function creates a new directory on the FTP server.
The ftp_mdtm() function returns the last modification time of the specified file.
The ftp_login() function logs in to the FTP server.
The ftp_get() function downloads a file from an FTP server.
The ftp_get_option() function returns various option settings for the current FTP connection.
The ftp_fput() function uploads an open file to an FTP server.
The ftp_fget() function downloads a file from the FTP server and saves it to an open file locally.
The ftp_exec() function requests the execution of a program or command on the FTP server.
The ftp_delete() function deletes a file on the FTP server.
The ftp_connect() function establishes a new FTP connection.
The ftp_close() function closes the FTP connection.
The ftp_chmod() function sets the permissions of a specified file on the FTP server.
The ftp_chdir() function changes the current directory on the FTP server.
The ftp_cdup() function changes the current directory to the parent directory on the FTP server.
The ftp_alloc() function allocates space for files to be uploaded to the FTP server.
The filter_var() function filters variables through a specified filter.
The filter_var_array() function obtains multiple variables and filters them.
The filter_list() function returns an array containing all supported filters.
The filter_input_array() function takes multiple inputs from outside the script and filters them.
The filter_input() function takes input from outside the script and filters it.
The filter_id() function returns the ID number of the specified filter.
The filter_has_var() function checks whether a variable of the specified input type exists.
The unlink() function deletes files.
The umask() function changes the current umask.
The touch() function sets the access and modification time of the specified file.
The tmpfile() function creates a temporary file with a unique file name in read-write (w+) mode.
The tempnam() function creates a temporary file with a unique file name.
The symlink() function creates symbolic links.
The stat() function returns information about a file.
The set_file_buffer() function sets the buffer size for open files.
The rmdir() function deletes empty directories.
The rewind() function rewinds the file pointer to the beginning of the file.
The rename() function renames a file or directory.
The realpath() function returns the absolute path.
The readlink() function returns the target pointed to by the symbolic link.
The readfile() function outputs a file.
The popen() function opens the process file pointer.
The pclose() function closes the pipe opened by popen().
The pathinfo() function returns file path information in the form of an array.
The parse_ini_file() function parses a configuration file and returns the settings in an array.
The move_uploaded_file() function moves the uploaded file to a new location.
The mkdir() function creates a directory.
The lstat() function returns information about a file or symbolic link.
The linkinfo() function returns connection information.
The link() function establishes a hard link.
The is_writeable() function determines whether the specified file is writable.
The is_writable() function determines whether the specified file is writable.
The is_uploaded_file() function determines whether the specified file was uploaded via HTTP POST.
The is_readable() function determines whether the specified file name is readable.
The is_link() function determines whether the specified file name is a symbolic link.
The is_file() function checks whether the specified file name is a normal file.
The is_executable() function checks whether the specified file is executable.
The is_dir() function checks whether the specified file is a directory.
The glob() function returns file names or directories that match the specified pattern.
The fwrite() function writes to a file (safe for use with binary files).
The ftruncate() function truncates the file to the specified length.
The current position of the ftell() function in the open file.
The fstat() function returns information about open files.
The fseek() function locates within an open file.
The fscanf() function parses input from an open file according to a specified format.
The fread() function reads files (safe for binary files).
The fputs() function writes to a file (safe for use with binary files).
The fputcsv() function formats rows to CSV and writes them to an open file.
The fpassthru() function outputs any remaining data at the file pointer.
The fopen() function opens a file or URL.
The fnmatch() function matches a filename or string based on a specified pattern.
The flock() function locks or releases a file.
The filetype() function returns the type of the specified file or directory.
The filesize() function returns the size of the specified file.
The fileperms() function returns the permissions of a file or directory.
The fileowner() function returns the owner of the file.
The filemtime() function returns the last modification time of the file contents.
The fileinode() function returns the inode number of the file.
The filegroup() function returns the group ID of the specified file.
The filectime() function returns the last inode modification time of the specified file.
The fileatime() function returns the last access time of the specified file.
The file_put_contents() function writes a string to a file.
The file_get_contents() function reads the entire file into a string.
The file_exists() function checks whether a file or directory exists.
The file() function reads the entire file into an array.
The fgetss() function reads a line from an open file and filters out HTML and PHP tags.
The fgets() function reads a line from a file pointer.
The fgetcsv() function reads a line from a file pointer and parses the CSV fields.
The fgetc() function reads a character from a file pointer.
The fflush() function outputs the buffer contents to a file.
The feof() function detects whether the end of file (eof) has been reached.
The fclose() function closes an open file.
The diskfreespace() function returns the free space in the directory. This function is an alias for the disk_free_space() function.
The disk_total_space() function returns the total disk size of the specified directory.
The disk_free_space() function returns the free space in the directory
The dirname() function returns the directory portion of the path.
The clearstatcache() function copies files.
The clearstatcache() function clears the file status cache.
The chown() function changes the owner of the specified file.
The chmod() function changes the file mode.
The chgrp() function changes the group to which a file belongs.
The basename() function returns the filename portion of the path.
set_exception_handler() handler() function
PHP Error and Logging functions
The set_exception_handler() function sets a user-defined exception handling function.
The set_error_handler() function sets a user-defined error handling function.
The restore_exception_handler() function restores the previous exception handler, which was changed by the set_exception_handler() function.
The restore_error_handler() function restores the previous error handler, which was changed by the set_error_handler() function.
error_reporting() sets PHP's error reporting level and returns the current level.
The error_log() function sends an error to the server error log, a file, or a remote destination.
The error_get_last() function gets the last error that occurred.
The debug_print_backtrace() function outputs backtrace.
debug_backtrace() cktrace() function
PHP Error and Logging functions
The scandir() function returns an array containing the files and directories in the specified path.
The rewinddir() function resets the directory handle opened by opendir().
The readdir() function returns the entry in the directory handle opened by opendir().
The opendir() function opens a directory handle and can be used by closedir(), readdir() and rewinddir().
The getcwd() function returns the current directory.
The closedir() function closes the directory handle opened by the opendir() function.
The dir() function opens a directory handle and returns an object. This object contains three methods: read(), rewind() and close().
The chroot() function changes the root directory of the current process to the specified directory.
The chdir() function changes the current directory to the specified directory.
The time() function returns the Unix timestamp of the current time.
The strtotime() function parses any English text datetime description into a Unix timestamp.
The strptime() function parses the date/time generated by strftime().
The strftime() function formats local time/date according to locale settings.
The mktime() function returns the Unix timestamp of a date.
The microtime() function returns the current Unix timestamp and microseconds.
The localtime() function returns the local time (an array).
The idate() function formats local time/date as an integer.
The gmstrftime() function formats GMT/UTC time/date according to local locale settings.
The gmmktime() function obtains the UNIX timestamp of a GMT date.
The gmdate() function formats a GMT/UTC date/time.
The gettimeofday() function returns an array containing the current time information.
The getdate() function obtains date/time information.
The date() function formats a local time/date.
The date_sunset() function returns the sunset time for the specified date and location.
The date_sunrise() function returns the sunrise time for the specified date and location.
The date_default_timezone_set() function sets the default time zone used for all date/time functions in scripts.
The date_default_timezone_get() function returns the default time zone used by all datetime functions in the script.
The checkdate() function verifies a Gregorian date.
The UnixToJD() function converts a Unix timestamp to a Julian day count.
The JulianToJD() function converts the Julian calendar to a Julian day count.
The JewishToJD() function converts the Jewish calendar to Julian day counting.
The JDToUnix() function converts a Julian day count to a Unix timestamp.
JDToGregorian() lian() function
PHP Array function
JDToGregorian() wish() function
PHP Array function
The JDToGregorian() function converts the Julian day count to the Gregorian calendar.
The JDToFrench() function converts the Julian day count to the French Republic calendar.
The JDMonthName() function returns the month string for the specified calendar.
The JDDayOfWeek() function returns the day of the week.
The GregorianToJD() function converts the Gregorian calendar to Julian day counts.
The FrenchToJD() function converts the French Republican calendar to Julian day counting.
The easter_days() function returns the number of days between Easter and March 21 for the specified year.
The easter_date() function returns the Unix timestamp of Easter midnight in the specified year.
The cal_to_jd() function converts the specified date to a Julian day count.
The cal_info() function returns an array containing information about the given calendar.
The cal_from_jd() function converts a Julian day count to a date in the specified calendar.
The cal_days_in_month() function returns the number of days in a month for the specified year and calendar.
The usort() function sorts an array using a user-defined function.
The uksort() function uses a user-defined comparison function to sort the array by key name and maintain the index relationship.
The uasort() function sorts an array using a user-defined comparison function and maintains index association (no new keys are assigned to elements).
The sort() function sorts the values of the given array in ascending order.
The sizeof() function counts the number of cells in an array or the number of attributes in an object.
The shuffle() function rearranges the elements in the array in random order.
The rsort() function sorts the elements of an array in reverse order by key value. Basically the same function as arsort().
The reset() function points the internal pointer of the array to the first element and returns the value of this element.
The range() function creates and returns an array containing a specified range of elements.
prev() HP prev() function
PHP Array function
The pos() function is an alias for the current() function. It returns the value of the current element in the array.
The next() function moves the pointer pointing to the current element to the position of the next element and returns the value of the current element.
The natsort() function sorts the elements in the given array using the natural ordering algorithm.
The natcasesort() function sorts the elements in the given array using a case-insensitive natural ordering algorithm.
The list() function assigns values to a set of variables using elements in an array.
The ksort() function sorts an array by key, preserving the original keys for array values.
The krsort() function sorts an array in reverse order by key, preserving the original keys for array values.
The key() function returns the key name of the element currently pointed to by the internal pointer of the array.
The in_array() function searches an array for a given value.
extract() extract() function
PHP Array function
The end() function points the internal array pointer to the last element and returns the value of that element if successful.
The each() function generates an array consisting of the key name and key value of the element currently pointed to by the internal pointer of the array, and moves the internal pointer forward.
The current() function returns the current element (cell) in the array.
The count() function counts the number of cells in an array or the number of attributes in an object.
The compact() function creates an array consisting of the variables taken as arguments. If there is an array in the parameter, the value of the variable in the array will also be obtained.
The asort() function sorts an array and maintains index relationships. Mainly used for sorting associative arrays where the order of cells is important.
The arsort() function sorts an array in reverse order and maintains the index relationship. Mainly used for sorting associative arrays where the order of cells is important.
array_walk_recursive() cursive() function
PHP Array function
The array_walk() function applies a callback function to each element in the array. Returns TRUE if successful, FALSE otherwise.
The array_values() function returns an array containing all key values in the given array, but does not retain the key names.
The array_unshift() function inserts one or more elements at the beginning of the array.
The array_unique() function removes duplicate values from an array and returns the resulting array.
The array_uintersect_assoc() function calculates the intersection of arrays with index checking and uses a callback function to compare the data.
The array_uintersect() function calculates the intersection of arrays and uses callback functions to compare the data.
The array_udiff_uassoc() function returns the portion of the array1 array that exists but does not exist in any other array. The key names in the returned array remain unchanged.
The array_udiff_assoc() function returns the portion of array1 that exists but does not exist in any other array.
The array_udiff() function returns an array containing all values in the compared array that are not in any other argument arrays, with the keys unchanged.
The array_sum() function returns the sum of all values in an array.
The array_splice() function is similar to the array_slice() function, selecting a range of elements in an array, but instead of returning them, it deletes them and replaces them with other values.
The array_slice() function removes a segment of value from the array based on conditions and returns it.
The array_shift() function deletes the first element in the array and returns the value of the deleted element.
The array_search() function, like in_array(), searches for a key value in an array. If the value is found, the key of the matching element is returned. If not found, returns false.
The array_reverse() function reverses the order of elements in the original array, creates a new array and returns it. If the second parameter is specified as true, the element's key name remains unchanged, otherwise the key name is lost.
The array_reduce() function uses callback functions to iteratively reduce an array to a single value. If a third argument is specified, it will be treated as the first value in the array, or as the final return value if the array is empty.
The array_rand() function randomly selects one or more elements from the array and returns it.
The array_push() function adds (push) one or more elements to the end of the first argument's array and returns the length of the new array.
The array_product() function calculates and returns the product of all values in an array.
The array_pop() function removes the last element from an array.
The array_pad() function inserts a specified number of elements with a specified value into an array.
The array_multisort() function sorts multiple arrays or multidimensional arrays.
The array_merge_recursive() function, like the array_merge() function, merges the elements of one or more arrays, with the values in one array appended to the previous array. and returns the resulting array.
The array_merge() function merges two or more arrays into one array.
The array_map() function returns the array after the user-defined function is applied. The callback function should accept the same number of arguments as the number of arrays passed to the array_map() function.
The array_keys() function returns a new array containing all the keys in the array.
The array_key_exists() function determines whether the specified key exists in an array. If the key exists, it returns true, otherwise it returns false.
The array_intersect_ukey() function uses a callback function to compare key names to calculate the intersection of arrays.
The array_intersect_uassoc() function uses a user-defined callback function to calculate the intersection of arrays and uses the callback function to compare the indices.
The array_intersect_key() function calculates the intersection of arrays using key comparison.
The array_intersect_assoc() function returns an array of intersections of two or more arrays.
The array_intersect() function returns an array of intersections of two or more arrays.
The array_flip() function returns a reversed array. If the same value appears multiple times, the last key will be its value and all other keys will be lost.
The array_filter() function uses a callback function to filter the elements in the array. If the custom filter function returns true, the current value of the operated array will be included in the returned result array, and the result will be formed into a new array. If the original array is an associative array, the key names remain unchanged.
The array_fill() function fills an array with the given value and returns an array with number elements and value. The returned array is numerically indexed, starting at the start position and increasing. If number is 0 or less than 0, an error occurs.
array_diff_ukey() returns an array containing the values of all keys that appear in array1 but do not appear in any other parameter array. Note that the relationship remains unchanged. Unlike array_diff(), the comparison is based on key names rather than values.
The array_diff_uassoc() function uses a user-defined callback function to do index checking to calculate the difference between two or more arrays. Returns an array containing the values in array1 but not in any of the other argument arrays.
The array_diff_key() function returns an array containing all keys that are in the compared array but are not in any of the other argument arrays.
The array_diff_assoc() function returns an array of differences between two arrays. This array contains all keys and values that are in the array being compared, but are not in any of the other argument arrays.
The array_diff() function returns an array of differences between two arrays. This array contains all keys that are in the array being compared, but are not in any of the other argument arrays.
The array_count_values() function is used to count the number of occurrences of all values in an array.
The array_combine() function creates a new array by merging two arrays, one with keys and the other with keys.
The array_chunk() function splits an array into new array chunks.
The array_change_key_case() function converts all KEYs of the array to uppercase or lowercase.
array() creates an array, with keys and values. If the key is omitted when specifying the array, an integer key is generated that starts at 0 and increments by 1.
Share to: