Home > Backend Development > PHP Tutorial > PHP function library (overview)

PHP function library (overview)

WBOY
Release: 2016-08-10 08:48:41
Original
1445 people have browsed it

Array function:

  • array_change_key_case — Returns an array whose string keys are all lowercase or uppercase
  • array_chunk — Splits an array into multiple
  • array_column — Returns a specified column in the array
  • array _combine — create An array, using the value of one array as its key name, and the value of the other array as its value
  • array_count_values ​​— counts the number of occurrences of all values ​​in the array
  • array_diff_assoc — calculates the difference of the array with index check
  • array_diff_key — Use key name comparison to calculate the difference set of the array
  • array_diff_uassoc — Use the user-provided callback function to do index checking to calculate the difference set of the array
  • array_diff_ukey — Use the callback function to compare the key name Array Difference
  • array_diff — Calculates the difference of an array
  • array_fill_keys — Fills the array with the specified keys and values ​​
  • array_fill — Fills the array with the given value
  • array_filter — Use callback Function to filter cells in an array
  • array_flip — Swap keys and values ​​in an array
  • array_intersect_assoc — Calculate the intersection of arrays with index checking
  • array_intersect_key — Calculate the intersection of arrays using key name comparison
  • array_intersect_uassoc — Calculate the intersection of arrays with index checking, use callback functions to compare indexes
  • array_intersect_ukey — Use callback functions to compare key names to calculate the intersection of arrays
  • array_intersect — Calculate the intersection of arrays
  • array_key_exists — Check to Whether the specified key or index exists in the array
  • array_keys — Returns some or all of the key names in the array
  • array_map — Apply the callback function to the cells of the given array
  • array_merge_recursive — Recursively merge one or more arrays
  • array_merge — Merge one or more arrays
  • array_multisort — Sort multiple arrays or multidimensional arrays
  • array_pad — Pad arrays with values ​​to a specified length
  • array_pop — Pop the last element of the array (pop)
  • array_product — Calculate the product of all values ​​in the array
  • array_push — Push one or more cells to the end of the array (push)
  • array_rand — Randomly remove one or more elements from an array
  • array_reduce — Use a callback function to iteratively reduce an array to a single value*
  • array_replace_recursive — Recursively replace the first array with the passed array elements of *
  • array_replace — Replace elements of the first array with the passed array *
  • array_reverse — Return an array with the cells in reverse order
  • array_search — Search the array for a given value if If successful, return the corresponding key name
  • array_shift — Move the unit at the beginning of the array out of the array *
  • array_slice — Take out a section from the array
  • array_splice — Remove a part of the array and replace it with other values*
  • array_sum — Calculate the sum of all values ​​in the array
  • array_udiff_assoc — Calculate the difference set of the array with index check, use the callback function to compare the data
  • array_udiff_uassoc — Calculate the difference set of the array with index check, use the callback function Compare data and index
  • array_udiff — Use callback function to compare data to calculate the difference set of arrays
  • array_uintersect_assoc — Calculate the intersection of arrays with index check, use callback function to compare data
  • array_uintersect_uassoc — Calculate with index check Intersection of arrays, use callback function to compare data and index
  • array_uintersect — Calculate intersection of arrays, use callback function to compare data
  • array_unique — Remove duplicate values ​​in the array
  • array_unshift — Insert at the beginning of the array One or more cells
  • array_values ​​— Returns all values ​​in the array
  • array_walk_recursive — Recursively applies the user function * to each member in the array
  • array_walk — Uses a user-defined function to Do callback processing for each element*
  • array — Create a new array
  • arsort — Reverse sort the array and maintain the index relationship*
  • asort — Sort the array and maintain the index relationship
  • compact — Create an array, including variable names and their values*
  • count — Count the number of cells in the array or the number of attributes in the object
  • current — Returns the current element in the array
  • each — Returns the current key/value pair in the array and moves the array pointer forward one step*
  • end — Points the internal pointer of the array to the last element
  • extract — Import variables from an array into the current symbol table*
  • in_array — Check whether a value exists in an array
  • key_exists — Alias ​​array_key_exists
  • key — Get from an associative array Key name
  • krsort — Sort the array in reverse order by the key name
  • ksort — Sort the array according to the key name
  • list — Assign the values ​​in the array to some variables*
  • natcasesort — Use The "natural sort" algorithm sorts the array case-insensitively
  • natsort — Sorts the array using the "natural sort" algorithm*
  • next — Moves the internal pointer in the array forward by one
  • pos — Alias ​​of current
  • prev — Rewind the internal pointer of the array by one bit *
  • range — Create an array containing the specified range unit
  • reset — Point the internal pointer of the array to the A unit *
  • rsort — Sort the array in reverse order
  • shuffle — Shuffle the array
  • sizeof — Alias ​​of count
  • sort — Sort the array
  • uasort — user Custom comparison function sorts the values ​​in the array and maintains index association*
  • uksort — Uses the user-defined comparison function to sort the keys in the array
  • usort — Uses the user-defined comparison Function to sort the values ​​in an array

---------------------------------- -------------------------------------------------- ---------------------------------------------

- -------------------------------------------------- -------------------------------------------------- --------------------------------

String functions:

  • addcslashes — Use backslashes to escape characters in a string in C language style
  • addslashes — Use backslashes to quote strings *
  • bin2hex — Function to convert a string of ASCII characters to Hexadecimal value
  • chop — Alias ​​for rtrim
  • chr — Returns the specified character Convert characters to another
  • convert_uudecode — Decode a uuencode-encoded string
  • convert_uuencode — Use uuencode to encode a string
  • count_chars — Return information about the characters used in the string
  • crc 32 — Calculate the crc32 polynomial of a string*
  • crypt — One-way string hash*
  • echo — Output one or more strings
  • explode — Use one string to split another string*
  • fprintf — Write the formatted string to the stream
  • get_html_translation_table — Return the translation table using htmlspecialchars and htmlentities*
  • hebrev — Convert logical-Hebrew ) to visual-Hebrew
  • hebrevc — Convert logical-Hebrew to visual-Hebrew and convert newlines
  • hex2bin — Convert hexadecimal string to binary string
  • html_entity_decode — Convert all HTML entities to their applicable characters
  • htmlentities — Convert all applicable characters to HTML entities
  • htmlspecialchars_decode — Convert special characters to HTML entities
  • implode — Convert the value of a one-dimensional array into a string
  • lcfirst — Make the first character of a string lowercase
  • levenshtein — Calculate the edit distance* between two strings Starting white space character (or other characters)
  • md5_file — Calculate the MD5 hash value of the specified file
  • md5 — Calculate the MD5 hash value of the string*
  • 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 — Insert an HTML newline mark *
  • number_format — before all new lines in the string Format a number with thousands separator *
  • ord — Return the ASCII code value of the character *
  • parse_str — Parse the string into multiple variables
  • print — Output the string
  • printf — Output formatted string
  • quoted_printable_decode — Convert quoted-printable string to 8-bit string
  • quoted_printable_encode — Convert 8-bit string to quoted-printable string
  • quotemeta — Escape metacharacter set*
  • rtrim — Delete whitespace characters (or other characters) at the end of the string
  • setlocale — Set locale information
  • sha1_file — Calculate the sha1 hash value of the file
  • sha1 — Calculate the sha1 hash value of a string
  • similar_text — Calculate the similarity* of two strings
  • sscanf — Parse the input characters according to the specified format
  • str_getcsv — Parse the CSV string into an array
  • str_ireplace — A case-ignoring version of str_replace
  • str_pad — Use another string to fill the characters The string is the specified length*
  • str_repeat — Repeat a string
  • str_replace — Substring replacement
  • str_rot13 — Perform ROT13 conversion on the string
  • str_shuffle — Randomly shuffle a string
  • str_split — Convert the string into an array*
  • str_word_count — Return the usage of words in the string
  • strcasecmp — Binary safe comparison of strings (not Case sensitive)
  • strchr — alias strstr
  • strcmp — Binary safe string comparison*
  • strcoll — Locale-based string comparison*
  • strcspn — Get mismatch mask Length of starting substring*
  • strip_tags — strip HTML and PHP tags from a string Where it appears (case-insensitive)
  • stripslashes — dereference a quoted string
  • stristr — a case-ignoring version of the strstr function
  • strlen — get the string length
  • strnatcasecmp — Compare strings using the "natural ordering" algorithm (case-insensitive)
  • strnatcmp — Compare strings using the natural ordering algorithm
  • strncasecmp — Binary-safe comparison of several characters at the beginning of a string (case-insensitive)
  • strncmp — Binary safe comparison of several characters at the beginning of a string*
  • strpbrk — Find any character in a set of characters in a string*
  • strpos — Find the first occurrence of a string*
  • strrchr — Find the last occurrence of the specified character in the string *
  • strrev — Reverse the string *
  • strripos — Calculate the position of the last occurrence of the specified string in the target string ( Case-insensitive)
  • strrpos — Calculate the position of the last occurrence of the specified string in the target string *
  • strspn — Calculate the first paragraph in the string where all characters exist in the specified character set The length of the string*
  • strstr — Find the first occurrence of the string *
  • strtok — Mark the split string *
  • strtolower — Convert the string to lowercase
  • strtoupper — Convert the string To uppercase
  • strtr — Convert the specified character *
  • substr_compare — Binary safe comparison of strings (compare the specified length from offset position)
  • substr_count — Count the number of occurrences of a string
  • substr_replace — Replace the substring of the string
  • substr — Return the substring of the string
  • trim — Remove the blank characters (or other characters) at the beginning and end of the string
  • ucfirst — Convert the first letter of the string to uppercase
  • ucwords — Convert the first letter of each word in the string to uppercase *
  • vfprintf — Write the formatted string to the stream
  • vprintf — Output the formatted string
  • vsprintf — Returns a formatted string
  • wordwrap — Breaks the string into a specified number of words*
  • -------------------------------- -------------------------------------------------- -------------------------------------------------- ----------
---------------------------------- -------------------------------------------------- --------------------------------------------------

JSON function:

json_decode — Encode a string in JSON format

json_encode — Encode variables in JSON

  • json_last_error_msg — Returns the error string of the last json_encode() or j son_decode( ) call
  • json_last_error — Returns the last error that occurred
  • --------------------------------- -------------------------------------------------- --------------------------------------------------
------------------------------------------------- -------------------------------------------------- ----------------------------------

URL function:

  • base64_decode — Decode data encoded using MIME base64
  • base64_encode — Encode data using MIME base64
  • get_headers — Get the server response to an HTTP request sent All headers
  • get_meta_tags — Extract all meta tag content attributes from a file, return an array
  • http_build_query — Generate the request string after URL-encoding
  • parse_url — Parse the URL, return it Components
  • rawurldecode — Decode the encoded URL string
  • rawurlencode — Encode the URL according to RFC 1738
  • urldecode — Decode the encoded URL string
  • urlencode — encoding URL string

---------------------------------------- -------------------------------------------------- ----------------------------------------

------ -------------------------------------------------- -------------------------------------------------- ------------------------

Session function:

  • session_abort — Discard session array changes and finish session
  • session_cache_expire — Returns the expiration time of the current cache
  • session_cache_limiter — Read/set the cache limiter
  • session_commit — Alias ​​of session_write_close
  • session_decode — Decode session data
  • session_destroy — Destroy a All data in the session
  • session_encode — Encode the current session data into a string
  • session_get_cookie_params — Get the session cookie parameters
  • session_id — Get/set the current session ID
  • session_is _registered — check variables Whether it is already registered in the session
  • session_module_name — Get/set the session module name
  • session_name — Read/set the session name
  • session_regenerate_id — Use the newly generated session ID to update the existing session ID
  • _Session_register_shutdown — Close the session
  • Session_register — register one or more global variables with the current session
  • session_reset — Re-Initialize Session Y With Original Values
  • session_SAVE_PATH — Reading/Set the preservation path of the current session
  • session_set_cookie_params — Set session cookie parameters
  • session_set_save_handler — Set user-defined session storage function
  • session_start — Start a new session or reuse an existing session
  • session _status — Returns the current session status
  • session_unregister — Unregister a global variable from the current session
  • session_unset — Free all session variables
  • session_write_close — Write session data and end session

---------- -------------------------------------------------- -------------------------------------------------- --------------------

-------------------------- -------------------------------------------------- -------------------------------------------------- ----

Classes/Object function:

  • __autoload — Attempt to load an undefined class
  • call_user_method_array — Call a user method while passing an array of parameters (deprecated)
  • call_user_method — Call a user method on a specific object (deprecated)
  • class_alias — Create an alias for a class
  • class_exists — Check if the class is defined
  • get_called_class — Late static binding ("Late Static Binding") The name of the class
  • get_class_methods — Return the methods of the class Array of names
  • get_class_vars — Returns an array of default attributes of the class
  • get_class — Returns the class name of the object
  • get_declared_classes — Returns an array of names of defined classes
  • get_declared_interfaces — Returns an array containing all declared interfaces
  • get_declared_traits — Returns an array of all defined traits
  • get_object_vars — Returns an associative array composed of object attributes
  • get_parent_class — Return object or class The parent class name
  • interface_exists — Check whether the interface has been defined
  • is_a — Return TRUE if the object belongs to this class or the class is the parent class of this object
  • is_subclass_of — If this object is the If it is a subclass of the class, TRUE will be returned
  • method_exists — Check whether the method of the class exists
  • property_exists — Check whether the object or class has the property
  • trait_exists — Check whether the specified trait exists

------------------------------------------------ -------------------------------------------------- --------------------------------

-------------- -------------------------------------------------- -------------------------------------------------- ----------------

MySQL functions:

  • mysql_affected_rows — Get the number of record rows affected by the previous MySQL operation
  • mysql_client_encoding — Return the name of the character set
  • mysql_close — Close the MySQL connection
  • mysql_connect — Open a connection to a MySQL server
  • mysql_create_db — Create a new MySQL database
  • mysql_data_seek — Move the internal result pointer
  • mysql_db_name — Get the result data
  • mysql_db _query — Send a MySQL query
  • mysql_drop_db — Drop (delete) A MySQL database
  • mysql_errno — Returns the numeric encoding of the error message in the previous MySQL operation
  • mysql_error — Returns the text error message generated by the previous MySQL operation
  • mysql_escape_string — Escapes a string for mysql_query
  • mysql_fetch_array — Get a row from the result set as an associative array, or a numeric array, or both
  • mysql_fetch_assoc — Get a row from the result set as an associative array
  • mysql_fetch_field — From the result Get columns centrally information and returned as an object
  • mysql_fetch_lengths — Get the length of each output in the result set
  • mysql_fetch_object — Get a row from the result set as an object
  • mysql_fetch_row — Get a row from the result set as an enumeration array
  • mysql_field_flags — Get the flags associated with the specified field from the result
  • mysql_field_len — Return the length of the specified field
  • mysql_field_name — Get the field name of the specified field in the result
  • mysql_field_seek — Concentrate the results pointer set Set to the specified field offset
  • mysql_field_table — Get the table name where the specified field is located
  • mysql_field_type — Get the type of the specified field in the result set
  • mysql_free_result — Release the result memory
  • mysql_get_client_info — get MySQL client information
  • mysql_get_host_info — Get MySQL host information
  • mysql_get_proto_info — Get MySQL protocol information
  • mysql_get_server_info — Get MySQL server information
  • mysql_info — Get the latest query information
  • mysql_insert_id — Get the ID generated by the previous INSERT operation
  • mysql_list_dbs — List all databases in the MySQL server
  • mysql_list_fields — List the fields in the MySQL result
  • mysql_list_processes — List MySQL processes
  • mysql_list_tables — List the tables in the MySQL database
  • mysql_num_fields — Get the number of fields in the result set
  • mysql_num_rows — Get the number of rows in the result set
  • mysql_pconnect — Open a link to My Persistent connection to SQL server
  • mysql_ping — Ping a server connection, reconnect if not connected
  • mysql_query — Send a MySQL query
  • mysql_real_escape_string — Escape special characters in strings used in SQL statements, taking into account the connection Current character set
  • mysql_result — Get result data
  • mysql_select_db — Select MySQL database
  • mysql_set_charset — Set the client’s character set
  • mysql _stat — Get the current system status
  • mysql_tablename — Get the table Name
  • mysql_thread_id — Returns the ID of the current thread
  • mysql_unbuffered_query — Sends an SQL query to MySQL without retrieving and caching the result rows

---------- -------------------------------------------------- -------------------------------------------------- ------------------

-------------------------------- -------------------------------------------------- -------------------------------------------------- ---

Math function:

  • abs — absolute value
  • acos — inverse cosine
  • acosh — inverse hyperbolic cosine
  • asin — inverse sine
  • asinh — inverse hyperbola Sine
  • atan2 — Arctangent of two parameters
  • atan — arctangent
  • atanh — inverse hyperbolic tangent
  • base_convert — convert numbers between arbitrary bases
  • bindec — convert binary to decimal
  • ceil — Rounding to one
  • cos — Cosine
  • cosh — Hyperbolic cosine
  • decbin — Convert decimal to binary
  • dechex — Convert decimal to Hexadecimal
  • decoct — Convert decimal to octal
  • deg2rad — Convert angle to radians
  • exp — Calculate the exponent of e
  • expm1 — Return exp(number) - 1, even when the value of number is close to zero It can also calculate accurate results
  • floor — Rounding by rounding method
  • fmod — Returns the floating point remainder of division
  • getrandmax — Displays the largest possible value of a random number
  • hexdec — Sixteen Convert base to decimal
  • hypot — Calculate the length of the hypotenuse of a right triangle
  • intdiv — Integer division
  • is_finite — Determine whether it is a finite value
  • is_infinite — Determine whether it is an infinite value
  • is_nan — Determine whether it is a legal value
  • lcg_value — Combined linear congruential generator
  • log10 — Logarithm with base 10
  • log1p — Return log(1 + number), even Accurate results can be calculated when the value of number is close to zero
  • log — natural logarithm
  • max — find the maximum value
  • min — find the minimum value
  • mt_getrandmax — display random numbers Maximum possible value of
  • mt_rand — Generate better random numbers
  • mt_srand — Seed a better random number generator
  • octdec — Convert octal to decimal
  • pi — Get Pi value
  • pow — Exponential expression
  • rad2deg — Convert radians to corresponding degrees
  • rand — Generate a random integer
  • round — Round floating point numbers
  • sin — sine
  • sinh — hyperbolic sine
  • sqrt — square root
  • srand — sow the random number generator seed
  • tan — tangent
  • tanh — hyperbolic tangent

------------------------------------------------ -------------------------------------------------- ----------------------------------

---------- -------------------------------------------------- -------------------------------------------------- -------------------

Date/Time function:

  • checkdate — Verify a Gregorian date
  • date_add — alias DateTime::add
  • date_create_from_format — alias DateTime::createFromFormat
  • date_create_immutable_ from_format — alias DateTimeImmutable::createFromFormat
  • date_create_immutable — alias DateTimeImmutable::__construct
  • date_create — alias DateTime::__construct
  • date_date_set — alias DateTime::setDate
  • date_default_timezone_get — Get all values ​​in a script Default time zone used by datetime functions
  • date_default_timezone_set — Set the default time zone used for all datetime functions in a script
  • date_diff — alias DateTime::diff
  • date_format — alias DateTime::format
  • date_get_last_errors — Alias ​​DateTime:: getLastErrors
  • date_interval_create_from_date_string — alias DateInterval::createFromDateString
  • date_interval_format — alias DateInterval::format
  • date_isodate_set — alias DateTime::setISOD ate
  • date_modify — alias DateTime::modify
  • date_offset_get — Alias ​​DateTime::getOffset
  • date_parse_from_format — Get info about given date formatted according to the specified format
  • date_parse — Returns associative array with detailed info about given date
  • date_sub — Alias ​​DateTime::sub
  • date_sun_info — Returns an array with information about sunset/sunrise and twilight begin/end
  • date_sunrise — Returns the sunrise time for a given date and location
  • date_sunset — Returns a given date and location Sunset time
  • date_time_set — alias DateTime::setTime
  • date_timestamp_get — alias DateTime::getTimestamp
  • date_timestamp_set — alias DateTime::setTimestamp
  • date_timezone_get — alias DateTime::getTimezone
  • date_timezone_set — alias DateTime::setTimezone
  • date — Format a local time/date
  • getdate — Get date/time information
  • gettimeofday — Get the current time
  • gmdate — GMT /UTC date/time
  • gmmktime — Get UNIX timestamp of GMT date
  • gmstrftime — Format GMT/UTC time/date according to locale
  • idate — Format local time date into integer
  • localtime — Get the local time
  • microtime — Return the current Unix timestamp and microseconds
  • mktime — Get the Unix timestamp of a date
  • strftime — Format local time according to regional settings/ date
  • strptime — Parse the date/time generated by strftime
  • strtotime — Parse any English text datetime description into a Unix timestamp
  • time — Return the current Unix timestamp
  • timezone_abbreviations_list — alias DateTimeZone::listAbbreviations
  • timezone_identifiers_list — alias DateTimeZone::listIdentifiers
  • timezone_location_get — alias DateTimeZone::getLocation
  • timezone_ name_from_abbr — Returns the timezone name from abbreviation
  • timezone_name_get — Alias ​​DateTimeZone: :getName
  • timezone_offset_get — alias DateTimeZone::getOffset
  • timezone_open — alias DateTimeZone::__construct
  • timezone_transitions_get — alias DateTimeZone::getTransitions
  • timezone_version_get — Gets the version of the timezonedb

The above has introduced the PHP function library (overview), including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template