Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the PHP5 functions?

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is to share with you what the PHP5 function has. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The usleep () function delays code execution by several 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 the specified time.

The time_nanosleep () function delays code execution for several seconds and nanoseconds.

The sleep () function delays code execution for several seconds.

The show_source () function syntactically highlights the file.

The strip_whitespace () function returns the source code file with deleted PHP comments and white space characters.

The pack () function loads the data into a binary string.

The ignore_user_abort () function sets whether disconnection from the client terminates the execution of the script.

The highlight_string () function syntactically highlights the string.

The highlight_file () function syntactically highlights the file.

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 calculates the string as 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 the constant.

The connection_status () function returns the current connection status.

The connection_aborted () function checks to see if the client is disconnected.

The zip_read () function reads the next file in the open zip file.

The zip_open () function opens the ZIP file for reading.

The zip_entry_read () function gets the content from the open zip archive project.

The zip_entry_open () function opens a ZIP archive project for reading.

The zip_entry_name () function returns the name of the zip archive project.

The zip_entry_filesize () function returns the original size of the zip archive project (before compression).

The zip_entry_compressionmethod () function returns the compression method of the zip archive project.

The zip_entry_compressedsize () function returns the compressed file size of the zip archive project.

The zip_entry_close () function closes the zip archive opened by the zip_entry_open () function.

The zip_close () function closes the zip archive opened by the zip_open () function.

The xml_set_unparsed_entity_decl_handler () function specifies the function to be called when an entity name (NDATA) declaration that cannot be resolved is encountered.

The xml_set_processing_instruction_handler () function specifies the function to call when the parser finds a processing instruction in the XML document.

The xml_set_object () function allows the use of a XML parser in an object.

The xml_set_notation_decl_handler () function specifies the function to be called when the parser finds the symbol declaration in the XML document.

The xml_set_external_entity_ref_handler () function specifies the function to be called when the parser finds an external entity in the XML document.

The xml_set_element_handler () function establishes the start and end element handlers.

The xml_set_default_handler () function establishes the default data handler for the XML parser.

The xml_set_character_data_handler () function sets up a character data processor.

The xml_parser_set_option () function sets options for the XML parser.

The xml_parser_get_option () function gets the option setting information from the XML parser.

The xml_parser_free () function releases the XML parser.

The xml_parser_create () function creates a XML parser.

The xml_parser_create_ns () function creates a XML parser with namespace support.

The xml_parse_into_struct () function parses the XML data into an array.

The xml_parse () function parses the 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 error description of the XML parser.

The utf8_encode () function encodes the ISO-8859-1 string as UTF-8.

The utf8_decode () function decodes the UTF-8 string into ISO-8859-1.

The wordwrap () function wraps the string according to the specified length.

The vsprintf () function writes the formatted string to the variable.

The vprintf () function outputs the formatted string.

The vfprintf () function writes the 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 white space characters and other predefined characters from both ends of the string.

The substr_replace () function replaces part of a string with another string.

The substr_count () function calculates the number of times a substring appears in a string.

The substr_compare () function compares two strings from the specified starting length.

The substr () function returns a portion of the 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 a string in another string.

The strspn () function returns the number of specific characters contained in the string.

The strrpos () function looks for the last occurrence of a string in another string.

The strripos () function looks for the last occurrence of a string in another string.

The strrev () function reverses the string.

The strrchr () function finds the position of the last occurrence of a string in another string and returns all characters from that position to the end of the string.

The strpos () function returns the position where the string first appears in another string.

The strpbrk () function searches the string for any 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 the string.

The stristr () function looks for the first occurrence of a string in another string.

The stripos () function returns the position where the string first appears in another string.

The stripslashes () function removes the backslash added by the addslashes () function.

The stripcslashes () function removes the backslash added by the addcslashes () function.

The strip_tags () function strips the tags off HTML, XML, and PHP.

The strcspn () function returns the number of characters found in the 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 in another string.

The strcasecmp () function compares two strings.

The str_word_count () function counts the number of words in the string.

The str_split () function splits the string into an array.

The str_shuffle () function randomly scrambles all characters in the string.

The str_rot13 () function performs ROT13 encoding on the string.

The str_replace () function replaces other characters in the string with one string.

The str_repeat () function repeats the string a specified number of times.

The str_pad () function populates the string to the specified length.

The str_ireplace () function replaces other characters in the string with one string.

The sscanf () function parses the input from a string according to the specified format.

The sprintf () function writes the formatted string to a variable.

The soundex () function calculates the soundex key of a string.

The similar_text () function calculates the number of matching characters for two strings.

The sha1_file () function calculates the SHA-1 hash of the file.

The sha1 () function calculates the SHA-1 hash of a string.

The setlocale () function sets the region information (region information).

Rtrim () P rtrim () function

PHP String function

The quotemeta () function adds a backslash before some predefined characters in the string.

The quoted_printable_decode () function decodes the quoted-printable-encoded string and returns an 8-bit string.

The printf () function outputs the formatted string.

The print () function outputs one or more strings.

The parse_str () function parses the query string into a variable.

The ord () function returns the ASCII value of the first character of the string.

The number_format () function formats numbers by grouping thousands of bits.

The nl2br () function inserts the HTML newline character () before each new line (\ n) in the string.

The nl_langinfo () function returns the specified local information.

The money_format () function formats a string as a currency string.

The metaphone () function calculates the metaphone key of a string.

The md5_file () function calculates the MD5 hash of the 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 the string.

The localeconv () function returns an array containing the format of local number and currency information.

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 to HTML entities.

The html_entity_decode () function converts HTML entities to characters.

The hebrevc () function converts Hebrew text from a right-to-left stream to a left-to-right stream. It also converts the new line (\ n) to.

The hebrev () function converts Hebrew text from a right-to-left stream to a left-to-right stream.

The get_html_translation_table () function returns the translation table used by the htmlentities () and htmlspecialchars () functions.

The fprintf () function writes the formatted string to the specified output stream (for example, a 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 with DES, Blowfish, or MD5.

The crc32 () function evaluates the crc32 polynomial of a string.

The count_chars () function returns information about the characters used in the string.

The convert_uuencode () function uses the uuencode algorithm to encode the string.

The convert_uudecode () function decodes the string encoded by uuencode.

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 characters from the specified ASCII value.

The chop () function removes white space characters or other predefined characters from the end of the string.

The bin2hex () function converts a string of ASCII characters to a hexadecimal value.

The addslashes () function adds a backslash before the specified predefined character.

The addcslashes () function adds a backslash before the specified character.

The xpath () function runs an XPath query on the XML document.

The simplexml_load_string () function loads the XML string into the object.

The simplexml_load_file () function loads the XML document into the object.

The simplexml_import_dom () function converts the DOM node into a SimpleXMLElement object.

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 the XML element from the SimpleXMLElement object.

The getDocNamespaces () function returns the namespace declared in the XML document from the SimpleXMLElement object.

The children () function gets the children of the specified node.

The attributes () function gets the attribute of the SimpleXML element.

The asXML () function returns the XML document as a string from the SimpleXMLElement object.

The addChild () function adds a child node to the specified XML node.

The addAttribute () function adds an attribute to the SimpleXML element.

The _ _ construct () function creates a new SimpleXMLElement object.

The mysql_unbuffered_query () function sends a SQL query to MySQL (no results are fetched / cached).

The mysql_thread_id () function returns the ID of the current thread.

The mysql_stat () function returns the current system state 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 the string used in the SQL statement.

The mysql_query () function executes a MySQL query.

The mysql_ping () function Ping a server connection and reconnect 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 the MySQL process.

The mysql_list_dbs () function lists all the 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 from the most recent query.

The mysql_get_server_info () function returns information about the MySQL server.

The mysql_get_proto_info () function returns information about the MySQL protocol.

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 up 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 name of the table where the specified field resides.

The mysql_field_seek () function sets the pointer in the result set to the specified field offset.

The mysql_field_name () function gets 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 gets the flag associated with the specified field from the result.

The mysql_fetch_row () function takes a row from the result set as an array of numbers.

The mysql_fetch_object () function takes a row from the result set (recordset) as an object.

The mysql_fetch_lengths () function gets the length of the contents of each field in a row.

The mysql_fetch_field () function takes the column information from the result set and returns it as an object.

The mysql_fetch_assoc () function takes a row from the result set as an associative array.

The mysql_fetch_array () function takes a row from the result set as an associative array, an array of numbers, or both.

The mysql_error () function returns a text error message from the previous MySQL operation.

The mysql_errno () function returns the numeric encoding of the error message in the previous MySQL operation.

The mysql_db_name () function gets the database name returned by the mysql_list_dbs () call.

The mysql_data_seek () function moves the pointer to the internal result.

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 that is currently connected.

The mysql_affected_rows () function returns the number of rows of records affected by the previous MySQL operation.

The tanh () function returns a hyperbolic tangent.

The tan () function returns a tangent.

The srand () function sows the seeds of the 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 the number of radians into angles.

The pow () function returns x to the y power.

The pi () function returns the value of pi.

The octdec () function converts octal to decimal.

Mt_srand () seeding Mersenne Twister random number generator.

Mt_rand () uses the Mersenne Twister algorithm to return random integers.

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.

The logarithm of log10 () with base 10.

Log () returns the natural logarithm.

Lcg_value () combined linear congruence generator.

Is_nan () determines whether it is a legal value.

Is_infinite () determines whether it is an infinite value.

The is_finite () function determines whether it is a finite value.

The hypot () function calculates the oblique length of a right-angled triangle.

The hexdec () function converts hexadecimal to decimal.

The fmod () function displays the maximum 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 can be calculated accurately even when the value of number is close to zero.

The exp () function calculates the index 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 digits.

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 arcsine of different values, and the result is an arc value between-PI/2 and PI/2.

The acosh () function returns the inverse hyperbolic cosine of a number.

The acos () function returns the inverse cosine of a number.

The abs () function returns the absolute value of a number.

The mail () function allows you to send e-mail messages directly from the 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 fetches errors from the libxml error buffer.

The libxml_clear_errors () function clears the libxml error buffer.

The setrawcookie () function does not URL encode the cookie value and sends a HTTP cookie.

The setcookie () function sends a HTTP cookie to the client.

The headers_sent () function checks whether / where the HTTP header has been sent.

The headers_list () function returns a list of response headers that have been sent (or are to be sent).

The header () function sends the original HTTP header 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 a 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 list of 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 the file to the server.

The ftp_pasv () function sets the passive mode to on or off.

The ftp_nlist () function returns a list of files in the specified directory.

The ftp_nb_put () function uploads the file to the server (non-blocking).

The ftp_nb_get () function takes the file from the FTP server and writes it to the local file (non-blocking).

The ftp_nb_fput () function uploads an open file and saves it as a file (non-blocking) on the FTP server.

The ftp_nb_fget () function downloads a file from the FTP server and saves it to a locally opened file (non-blocking).

The ftp_nb_continue () function continuously fetches / 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 the 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 the 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 for the 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 the specified filter.

The filter_var_array () function takes multiple variables and filters them.

The filter_list () function returns an array of 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 for the existence of a variable of the specified input type.

The unlink () function deletes the file.

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 the file.

The set_file_buffer () function sets the buffer size of the open file.

The rmdir () function deletes the empty directory.

The rewind () function reverses the position of the file pointer back 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 that the symbolic link points to.

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 information about the file path as an array.

The parse_ini_file () function parses a configuration file and returns its settings as 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 information about the connection.

The link () function establishes a hard connection.

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 is uploaded through 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 a file name or directory that matches the specified pattern.

The fwrite () function writes to a file (which can be safely used for binary files).

The ftruncate () function truncates the file to a specified length.

The current location of the ftell () function in the open file.

The fstat () function returns information about opening the file.

The fseek () function locates in the open file.

The fscanf () function parses the input from the open file according to the specified format.

The fread () function reads files (which can be safely used for binary files).

The fputs () function writes to a file (which can be safely used for binary files).

The fputcsv () function formats the line as CSV and writes it to an open file.

The fpassthru () function outputs all the remaining data at the file pointer.

The fopen () function opens a file or URL.

The fnmatch () function matches the file name or string based on the specified pattern.

The flock () function locks or releases the 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 permissions for a file or directory.

The fileowner () function returns the owner of the file.

The filemtime () function returns the last time the contents of the file were modified.

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 the 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 the open file and filters out the HTML and PHP tags.

The fgets () function reads a line from the file pointer.

The fgetcsv () function reads a line from the file pointer and parses the CSV field.

The fgetc () function reads a character from the file pointer.

The fflush () function outputs the buffered contents to a file.

The feof () function detects whether the end of the 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 the file.

The clearstatcache () function clears the file state 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 the 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 the user-defined exception handler.

The set_error_handler () function sets the user-defined error handling function.

The restore_exception_handler () function restores the previous exception handler, which is changed by the set_exception_handler () function.

The restore_error_handler () function restores the previous error handler, which is changed by the set_error_handler () function.

Error_reporting () sets the error level of PHP and returns the current level.

The error_log () function sends an error to the server error record, file, or 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 of files and directories in the specified path.

The rewinddir () function resets the directory handle opened by opendir ().

The readdir () function returns entries in the directory handle opened by opendir ().

The opendir () function opens a directory handle that 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 the date-time description of any English text into a Unix timestamp.

The strptime () function parses the date / time generated by strftime ().

The strftime () function formats the local time / date according to the locale.

The mktime () function returns the Unix timestamp of a date.

The microtime () function returns the current Unix timestamp and number of microseconds.

The localtime () function returns the local time (an array).

The idate () function formats the local time / date as an integer.

The gmstrftime () function formats the GMT/UTC time / date according to the local locale.

The gmmktime () function gets the UNIX timestamp of the GMT date.

The gmdate () function formats the GMT/UTC date / time.

The gettimeofday () function returns an array containing the current time information.

The getdate () function gets the date / time information.

The date () function formats a local time / date.

The date_sunset () function returns the sunset time of the specified date and place.

The date_sunrise () function returns the sunrise time of the specified date and place.

The date_default_timezone_set () function sets the default time zone for all date / time functions in the script.

The date_default_timezone_get () function returns the default time zone used by all date-time functions in the script.

The checkdate () function validates a Gregorian date.

The UnixToJD () function converts the Unix timestamp into a Julian day count.

The JulianToJD () function converts the Julian calendar to a Julian day count.

The JewishToJD () function converts the Jewish calendar to a Julian day count.

The JDToUnix () function converts the 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 Gregory calendar.

The JDToFrench () function converts the Julian day count to the French 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 Gregory calendar into a Julian day count.

The FrenchToJD () function converts the French Republican calendar into a Julian day count.

The easter_days () function returns the number of days between Easter and March 21 in the specified year.

The easter_date () function returns the Unix timestamp of midnight Easter for 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 a given calendar.

The cal_from_jd () function converts the Julian day count to the date of 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 the array using a user-defined function.

The uksort () function uses a user-defined comparison function to sort the array by key name and maintains an indexed relationship.

The uasort () function sorts the array using a user-defined comparison function and maintains the index association (no new keys are assigned to the element).

The sort () function sorts the values of a given array in ascending order.

The sizeof () function calculates the number of elements 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 reverses the elements of the array by key value. The function is basically the same as arsort ().

The reset () function points the inner pointer of the array to the first element and returns the value of that element.

The range () function creates and returns an array of elements of the specified range.

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 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 a given array using a natural order algorithm.

The natcasesort () function sorts the elements in a given array using a case-insensitive natural order algorithm.

The list () function assigns values to a set of variables with elements in the array.

The ksort () function sorts the array by key name, keeping the original key for the array value.

The krsort () function reverses the array by key, keeping the original key for the array value.

The key () function returns the key name of the element that the pointer inside the array currently points to.

The in_array () function searches the array for the given value.

Extract () extract () function

PHP Array function

The end () function points the internal pointer to the last element of the array and returns the value of that element if successful.

The each () function generates an array of key names and key values of the elements that the array's current internal pointer points to, and moves the internal pointer forward.

The current () function returns the current element (unit) in the array.

The count () function calculates the number of elements in an array or the number of attributes in an object.

The compact () function creates an array of variables with parameters. If there is an array in the parameter, the value of the variable in the array is also obtained.

The asort () function sorts the array and maintains an indexed relationship. It is mainly used to sort those associative arrays whose cell order is very important.

The arsort () function sorts the array in reverse and maintains the index relationship. It is mainly used to sort those associative arrays whose cell order is very 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 the key values in a given array, but does not retain the key name.

The array_unshift () function inserts one or more elements at the beginning of the array.

The array_unique () function removes duplicate values from the array and returns an array of results.

The array_uintersect_assoc () function checks the intersection of computed arrays with an index and compares the data with a callback function.

The array_uintersect () function calculates the intersection of the array and uses the callback function to compare the data.

The array_udiff_uassoc () function returns parts of the array1 array that exist but none of the other arrays exist. The key name in the returned array remains the same.

The array_udiff_assoc () function returns parts that exist in array1 but do not exist in other arrays.

The array_udiff () function returns an array that contains all the values in the compared array, but not in any other parameter array, with the key name unchanged.

The array_sum () function returns the sum of all the values in the array.

The array_splice () function is similar to the array_slice () function in that it selects a series of elements in the array, but does not return them, but removes them and replaces them with other values.

The array_slice () function fetches a value in the array based on the condition 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 (), looks for a key value in the array. If the value is found, the key name of the matching element is returned. If it is not found, false is returned.

The array_reverse () function flips the order of the elements in the original array, creates a new array, and returns. If the second parameter is specified as true, the key name of the element remains unchanged, otherwise the key name will be lost.

The array_reduce () function uses the callback function to iteratively simplify the array to a single value. If you specify a third parameter, it is 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.

The array_push () function adds one or more elements (into the stack) to the end of the array of the first argument, and then returns the length of the new array.

The array_product () function calculates and returns the product of all the values in the array.

The array_pop () function deletes the last element in the array.

The array_pad () function inserts a specified number of elements with the 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, combines the elements of one or more arrays, and the values in one array are appended to the previous array. And returns an array as a result.

The array_merge () function combines two or more arrays into a single array.

The array_map () function returns the array after the action of the user-defined function. The callback function should accept the same number of arguments as the array passed to the array_map () function.

The array_keys () function returns a new array containing all the key names in the array.

The array_key_exists () function determines whether the specified key exists in an array, and returns true if the key exists, or false otherwise.

The array_intersect_ukey () function uses the callback function to compare key names to calculate the intersection of arrays.

The array_intersect_uassoc () function uses the user-defined callback function to calculate the intersection of the array and compares the index with the callback function.

The array_intersect_key () function uses key name comparison to calculate the intersection of arrays.

The array_intersect_assoc () function returns an intersecting array of two or more arrays.

The array_intersect () function returns an intersecting array of two or more arrays.

The array_flip () function returns an inverted array, and if the same value occurs multiple times, the last key name will be its value, and all other key names will be lost.

The array_filter () function filters elements in the array with a callback function, and if the custom filter function returns true, the current value of the array being manipulated will be included in the returned result array and the results will be grouped into a new array. If the original array is an associative array, the key name remains the same.

The array_fill () function populates the array with the given value, and the returned array has number elements with a value of value. The returned array uses a numeric index, starting at the start position and incrementing. If number is 0 or less than 0, an error occurs.

Array_diff_ukey () returns an array containing all the values of key names that appear in array1 but not in any other parameter array. Note that the association relationship remains unchanged. Unlike array_diff (), the comparison is based on the key name rather than the value.

The array_diff_uassoc () function uses the user-defined callback function (callback) for index checking to calculate the difference between two or more arrays. Returns an array that includes values in array1 but not in any other parameter array.

The array_diff_key () function returns an array that contains all the keys in the array being compared, but not in any other parameter array.

The array_diff_assoc () function returns an array of differences between two arrays. This array includes all keys and values in the array being compared, but not in any other parameter array.

The array_diff () function returns an array of differences between two arrays. This array includes all the key values in the array being compared, but not in any other parameter array.

The array_count_values () function is used to count the number of occurrences of all values in the array.

The array_combine () function creates a new array by merging two arrays, one of which is the key name and the other whose value is the key value.

The array_chunk () function splits an array into new array blocks.

The array_change_key_case () function converts all KEY 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, and the key starts at 0 and is incremented by 1.

Thank you for reading! This is the end of this article on "what are the PHP5 functions?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report