Review of common functions in PHP

Source: Internet
Author: User
Tags binary to decimal crc32 decimal to binary md5 hash mysql host natural logarithm sha1 hash symlink
The following is a detailed analysis of common functions in PHP. For more information, see array_change_key_case. the returned string key names are all lowercase or upper-case arrays.
Array_chunk-divide an array into multiple
Array_combine-creates an array and uses the value of one array as its key name, and the value of another array as its value
Array_count_values-count the number of occurrences of all values in the array
Array_diff_assoc-calculate the array's difference set with index check
Array_diff_key-use the key name to compare the difference set of the calculated array
Array_diff_uassoc-use the callback function provided by the user to perform an index check to calculate the array's difference set
Array_diff_ukey-use the callback function to compare the difference set of the calculated array with the key name
Array_diff-calculate the difference set of the array
Array_fill_keys-Fill an array with values, specifying keys
Array_fill-fill the array with the given value
Array_filter-filter elements in the array using the callback function
Array_flip-swap the keys and values in the array
Array_intersect_assoc-intersection of arrays computed by checking indexes
Array_intersect_key-use a key name to compare and calculate the intersection of arrays
Array_intersect_uassoc-returns the intersection of arrays computed by checking indexes and compares indexes with callback functions.
Array_intersect_ukey-use the callback function to compare key names to calculate the intersection of arrays
Array_intersect-calculates the intersection of arrays
Array_key_exists-check whether the given key name or index exists in the array
Array_keys-returns all the key names in the array.
Array_map-calls the callback function to the unit of the given array.
Array_merge_recursive-recursively merge one or more arrays
Array_merge-merge one or more arrays
Array_multisort-sorts multiple arrays or multi-dimensional arrays.
Array_pad-fill the array with a value to the specified length
Array_pop-bring up the last unit of the array (Out Stack)
Array_product-calculate the product of all values in the array
Array_push-push one or more units to the end of the array (into the stack)
Array_rand-randomly retrieve one or more units from the array
Array_reduce-use callback functions to iteratively simplify an array to a single value
Array_reverse-returns an array with the opposite unit order.
Array_search-search for a given value in the array. if the value is successful, the corresponding key name is returned.
Array_shift-removes elements starting with an array from the array
Array_slice-extract a segment from the array
Array_splice-removes a part of the array and replaces it with other values.
Array_sum-calculates the sum of all values in the array
Array_udiff_assoc-calculate the difference set of the array with index check and use the callback function to compare data
Array_udiff_uassoc-calculate the difference set of the array with index check, and use the callback function to compare data and indexes.
Array_udiff-use the callback function to compare data to calculate the difference set of the array
Array_uintersect_assoc-returns the intersection of arrays computed by checking indexes and compares data with callback functions.
Array_uintersect_uassoc-returns the intersection of arrays computed by checking indexes and compares data and indexes using callback functions.
Array_uintersect-calculate the intersection of arrays and use the callback function to compare data
Array_unique-Remove repeated values from the array
Array_unshift-insert one or more units at the beginning of the array
Array_values-returns all values in the array.
Array_walk_recursive-recursively applies user functions to each member in the array
Array_walk-apply user functions to each member in the array
Array-create an array
Arsort-sorts arrays in reverse order and maintains the index relationship.
Asort-sorts arrays and maintains the index relationship
Compact-create an array, including variable names and their values
Count-calculates the number of units in the array or the number of attributes in the object.
Current-returns the current cell in the array.
Each-returns the current key/value pair in the array and moves the array pointer one step forward.
End-points the internal pointer of the array to the last unit.
Extract-import the variable from the array to the current symbol table
In_array-check whether a value exists in the array
Key-get the key name from the associated array
Krsort-sort arrays in reverse order by key name
Ksort-sort the array by key name
List-assign values in the array to some variables
Natcasesort-use the "natural sorting" algorithm to sort arrays by case-insensitive letters
Natsort-sort arrays using the "natural sorting" algorithm
Next-move the internal pointer in the array to a forward position.
Alias of pos-current ()
Prev-returns the internal pointer of the array to one position.
Range-create an array containing the specified range units
Reset-point the internal pointer of the array to the first unit
Rsort-reverse sorting of arrays
Shuffle-disrupt the array
Alias of sizeof-count ()
Sort-sort arrays
Uasort-sort the values in the array using the user-defined comparison function and maintain the index Association
Uksort-sort the key names in the array using the user-defined comparison function
Usort-sort the values in the array using the user-defined comparison function
Call_user_method_array-call a user method and pass the parameter array (obsolete)
Call_user_method-call the user method for a specific object (obsolete)
Class_exists-check whether the class is defined
Get_class_methods-returns an array composed of class method names.
Get_class_vars-returns an array composed of the default attributes of the class.
Get_class-class name of the returned object
Get_declared_classes-returns an array composed of the names of defined classes.
Get_declared_interfaces-returns an array containing all declared interfaces.
Get_object_vars-returns an associated array composed of object attributes.
Get_parent_class-return the parent class name of the object or class
Interface_exists-check whether the interface has been defined
Is_a-if the object belongs to this class or the class is the parent class of this object, TRUE is returned.
Is_subclass_of-if this object is a subclass of this class, TRUE is returned.
Method_exists-check whether the class method exists
Property_exists-check whether the object or class has this attribute
Checkdate-verify a greaguri date
Date_default_timezone_get-gets the default time zone used by all the datetime functions in a script.
Date_default_timezone_set-sets the default time zone used for all date and time functions in a script.
Date_time_set-Sets the time
Date_timezone_get-Return time zone relative to given DateTime
Date_timezone_set-Sets the time zone for the DateTime object
Date-format a local time/date
Getdate-get date/time information
Gettimeofday-get current time
Gmdate-format a GMT/UTC date/time
Gmmktime-obtain the UNIX timestamp of the GMT Date
Gmstrftime-format GMT/UTC time/date based on region settings
Idate-format the local time and date as an integer
Localtime-get local time
Microtime-returns the current Unix timestamp and number of microseconds
Mktime-obtain the Unix timestamp of a date
Strftime-format local time/date based on region settings
Strptime-parse the date/time generated by strftime ()
Strtotime-parses the date and time descriptions of any English text into Unix timestamps
Time-returns the current Unix timestamp
Chdir-Change Directory
Chroot-change root directory
Dir-directory class
Closedir-close directory handle
Getcwd-get the current working directory
Opendir-Open Directory handle
Readdir-read entries from the directory handle
Rewinddir-reverse directory handle
Scandir-list files and directories in a specified path
Basename-part of the file name in the returned path
Chgrp-change the group to which the file belongs
Chmod-change file mode
Chown-change the file owner
Clearstatcache-clear the file status cache
Copy-copy an object
Delete-see unlink () or unset ()
Dirname-directory part of the returned path
Disk_free_space-return the available space in the directory
Disk_total_space-returns the total disk size of a directory
Diskfreespace-disk_free_space () alias
Fclose-close an opened file pointer
Feof-test whether the file pointer is at the end of the file
Fflush-outputs Buffered content to a file
Fgetc-read characters from the file pointer
Fgetcsv-read a row from the file pointer and parse the CSV field
Fgets-read a row from the file pointer
Fgetss-read a row from the file pointer and filter out the HTML tag
File_exists-check whether the file or directory exists
File_get_contents-read the entire file into a string
File_put_contents-write a string to a file
File-read the entire file into an array
Fileatime-the last time the file was accessed
Filectime-get the inode modification time of the file
Filegroup-the group for obtaining files
Fileinode-get the inode of the file
Filemtime-get file modification time
Fileowner-get the file owner
Fileperms-get file permissions
Filesize-get the file size
Filetype-get file type
Flock-lightweight consultation file locking
Fnmatch-match the file name in the pattern
Fopen-open a file or URL
Fpassthru-all the remaining data at the output file pointer
Fputcsv-format rows as CSV and write file pointers
Fputs-fwrite () alias
Fread-read files (which can be safely used for binary files)
Fscanf-format input from file
Fseek-locate in file pointer
Fstat-get file information through the opened file pointer
Ftell-returned file pointer read/write location
Ftruncate-truncates a file to a specified length
Fwrite-write a file (which can be safely used for binary files)
Glob-find the file path that matches the pattern
Is_dir-determine whether the given file name is a directory
Is_executable-determine whether a given file name can be executed
Is_file-determine whether the given file name is a normal file
Is_link-determine whether a given file name is a symbolic connection
Is_readable-determine whether the given file name is readable
Is_uploaded_file-determines whether the file is uploaded through http post.
Is_writable-determine whether a given file name can be written
Is_writeable-is_writable () alias
Lchgrp-Changes group ownership of symlink
Lchown-Changes user ownership of symlink
Link-create a hard connection
Linkinfo-get the connection information
Lstat-displays information about a file or symbolic connection.
Mkdir-create a directory
Move_uploaded_file-move the uploaded file to a new location
Parse_ini_file-parse a configuration file
Pathinfo-returned file path information
Pclose-disable process file pointer
Popen-open process file pointer
Readfile-output a file
Readlink-returns the target to which the symbolic connection points.
Realpath-returns the normalized absolute path name.
Rename-rename a file or directory
Rewind-position of the inverted file pointer
Rmdir-Delete directory
Set_file_buffer-stream_set_write_buffer () alias
Stat-file information
Symlink-create a symbolic connection
Tempnam-create a file with a unique file name
Tmpfile-create a temporary file
Touch-set the file access and modification time
Umask-change the current umask
Unlink-delete an object
Mail-send email
Abs-absolute value
Acossh-inverse hyperbolic cosine
Asinh-Inverse hyperbolic sine
Atan2-arc tangent of two parameters
Atan-arc tangent
Atanh-antihyperbolic tangent
Base_convert-convert a number between any hexadecimal values
Bindec-Convert binary to decimal
Ceil-integer in one method
Cosh-hyperbolic cosine
Decbin-decimal to binary
Dechex-decimal to hexadecimal
Decoct-decimal to octal
Deg 2rad-converts degrees to radians
Exp-calculate the e index
Expm1-returns exp (number)-1. even if the number value is close to zero, the exact result can be calculated.
Fmod-returns the remainder of the floating point number of the division.
Getrandmax-display the maximum possible values of a random number
Hexdec-hexadecimal conversion to decimal
Hypot-calculates the oblique edge length of the angular triangle
Is_finite-determine if it is a finite value
Is_infinite-determines if it is an infinite value
Is_nan-determine whether it is a valid value
Lcg_value-composite linear coequal generator
Log10-base-10 logarithm
Log1p-return log (1 + number), even when the number value is close to zero, the accurate result can be calculated.
Log-Natural logarithm
Max-find the maximum value
Min-find the minimum value
Mt_getrandmax-display the maximum possible value of a random number
Mt_rand-generate better random numbers
Mt_srand-play a better random number generator seed
Octdec-octal to decimal
Pi-obtain the circumference rate value
Pow-exponential expression
Rad2deg-converts radians to degrees.
Rand-generate a random integer
Round-rounding floating point numbers
Sinh-hyperbolic sine
Sqrt-square root
Srand-broadcast the seed of the random number generator
Tanh-hyperbolic tangent
Mysql_affected_rows-obtain the number of records affected by the previous MySQL operation
Mysql_change_user-change the user logged on to the active connection
Mysql_client_encoding-name of the returned character set
Mysql_close-close MySQL connection
Mysql_connect-open a connection to the MySQL server
Mysql_create_db-create a MySQL database
Mysql_data_seek-move internal result Pointer
Mysql_db_name-get result data
Mysql_db_query-send a MySQL Query
Mysql_drop_db-discard (delete) a MySQL database
Mysql_errno-returns the numeric encoding of the error message in the previous MySQL operation
Mysql_error-return the text error message generated by the previous MySQL operation
Mysql_escape_string-escape a string for mysql_query
Mysql_fetch_array-get a row from the result set as an associated array, or number array, or both
Mysql_fetch_assoc-get a row from the result set as the associated array
Mysql_fetch_field-retrieve column information from the result set and return it as an object
Mysql_fetch_lengths-length of each output in the result set
Mysql_fetch_object-get a row from the result set as an object
Mysql_fetch_row-retrieve a row from the result set as an enumerated array
Mysql_field_flags-retrieve the flag associated with the specified field from the result
Mysql_field_len-return the length of the specified field
Mysql_field_name-field name of the specified field in the result obtained
Mysql_field_seek-set the pointer in the result set to the specified field offset.
Mysql_field_table-get the name of the table where the specified field is located
Mysql_field_type-specify the field type in the result set.
Mysql_free_result-release result memory
Mysql_get_client_info-obtain MySQL client information
Mysql_get_host_info-obtain MySQL host information
Mysql_get_proto_info-obtain MySQL protocol information
Mysql_get_server_info-obtain MySQL server information
Mysql_info-obtain the information of the last query
Mysql_insert_id-get the ID generated by the previous INSERT operation
Mysql_list_dbs-list all databases on the MySQL server
Mysql_list_fields-list fields in MySQL results
Mysql_list_processes-list MySQL processes
Mysql_list_tables-list tables in the MySQL database
Mysql_num_fields-number of fields in the result set obtained
Mysql_num_rows-number of rows in the result set
Mysql_pconnect-open a persistent connection to the MySQL server
Mysql_ping-Ping a server connection. if there is no connection, reconnect.
Mysql_query-send a MySQL Query
Mysql_real_escape_string-special characters in the character strings used in the escape SQL statement, taking into account the connected current character set
Mysql_result-get result data
Mysql_select_db-select MySQL database
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-a row that sends an SQL query to MySQL and does not obtain or cache the result.
Flush-refresh the output buffer
Ob_clean-Clean (erase) the output buffer
Ob_end_clean-Clean (erase) the output buffer and turn off output buffering
Ob_end_flush-Flush (send) the output buffer and turn off output buffering
Ob_flush-Flush (send) the output buffer
Ob_get_clean-Get current buffer contents and delete current output buffer
Ob_get_contents-Return the contents of the output buffer
Ob_get_flush-Flush the output buffer, return it as a string and turn off output buffering
Ob_get_length-Return the length of the output buffer
Ob_get_level-Return the nesting level of the output buffering mechanic
Ob_get_status-Get status of output buffers
Ob_gzhandler-ob_start callback function to gzip output buffer
Ob_implicit_flush-Turn implicit flush on/off
Ob_list_handlers-List all output handlers in use
Ob_start-Turn on output buffering
Output_add_rewrite_var-Add URL rewriter values
Output_reset_rewrite_vars-Reset URL rewriter values
Preg_grep-returns the array unit that matches the pattern.
Preg_last_error-Returns the error code of the last PCRE regex execution
Preg_match_all-perform global regular expression matching
Preg_match-regular expression matching
Preg_quote-escape regular expression characters
Preg_replace_callback-use the callback function to search and replace regular expressions
Preg_replace-search and replace a regular expression
Preg_split-use regular expressions to split strings
Session_cache_expire-Return current cache expire
Session_cache_limiter-Get and/or set the current cache limiter
Session_commit-session_write_close () alias
Session_decode-Decodes session data from a string
Session_destroy-Destroys all data registered to a session
Session_encode-encode the current session data into a string
Session_get_cookie_params-Get the session cookie parameters
Session_id-Get and/or set the current session id
Session_is_registered-Find out whether a global variable is registered in a session
Session_module_name-Get and/or set the current session module
Session_name-Get and/or set the current session name
Session_regenerate_id-Update the current session id with a newly generated one
Session_register-Register one or more global variables with the current session
Session_save_path-Get and/or set the current session save path
Session_set_cookie_params-Set the session cookie parameters
Session_set_save_handler-Sets user-level session storage functions
Session_start-Initialize session data
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
Ereg_replace-regular expression replacement
Ereg-regular expression matching
Eregi_replace-replace a case-insensitive regular expression
Eregi-case-insensitive regular expression matching
Split-use regular expressions to split strings into arrays
Spliti-use regular expressions to split strings into arrays without case sensitivity
SQL _regcase-generate a regular expression for matching with no size difference
Addcslashes-escape characters in strings using backslash in the C-language style
Addslashes-use a backslash to reference a string
Bin2hex-Convert binary data to hexadecimal representation
Alias of chop-rtrim ()
Chr-return the specified character
Chunk_split-splits a string into small parts
Count_chars-returns the characters used by the string.
Crc32-calculate the crc32 polynomial of a string
Crypt-One-way string encryption (hashing)
Echo-Output one or more strings
Explode-use one string to separate another string
Fprintf-Write a formatted string to a stream
Get_html_translation_table-Returns the translation table used by htmlspecialchars () and htmlentities ()
Hebrev-Convert logical Hebrew text to visual text
Hebrevc-Convert logical Hebrew text to visual text with newline conversion
Html_entity_decode-Convert all HTML entities to their applicable characters
Htmlentities-Convert all applicable characters to HTML entities
Htmlspecialchars_decode-Convert special HTML entities back to characters
Htmlspecialchars-Convert special characters to HTML entities
Implode-Join array elements with a string
Join-alias implode ()
Levenshtein-Calculate Levenshtein distance between two strings
Localeconv-Get numeric formatting information
Ltrim-Strip whitespace (or other characters) from the beginning of a string
Md5_file-Calculates the md5 hash of a given file
Md5-Calculate the md5 hash of a 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-Inserts HTML line breaks before all newlines in a string
Number_format-Format a number with grouped thousands
Ord-Return ASCII value of character
Parse_str-Parses the string into variables
Print-Output a string
Printf-Output a formatted string
Quoted_printable_decode-Convert a quoted-printable string to an 8-bit string
Quotemeta-Quote meta characters
Rtrim-Strip whitespace (or other characters) from the end of a string
Setlocale-Set locale information
Shaw.file-Calculate the sha1 hash of a file
Sha1-Calculate the sha1 hash of a string
Similar_text-Calculate the similarity between two strings
Soundex-Calculate the soundex key of a string
Sprintf-Return a formatted string
Sscanf-Parses input from a string according to a format
Str_getcsv-Parse a CSV string into an array
Str_ireplace-Case-insensitive version of str_replace ().
Str_pad-Pad a string to a certain length with another string
Str_repeat-Repeat a string
Str_replace-Replace all occurrences of the search string with the replacement string
Str_rot13-Perform the rot13 transform on a string
Str_shuffle-Randomly shuffles a string
Str_split-Convert a string to an array
Str_word_count-Return information about words used in a string
Strcasecmp-Binary safe case-insensitive string comparison
Strchr-alias strstr ()
Strcmp-Binary safe string comparison
Strcoll-Locale based string comparison
Strcsps-find length of initial segment not matching mask
Strip_tags-Strip HTML and PHP tags from a string
Stripcslashes-Un-quote string quoted with addcslashes ()
Stripos-Find position of first occurrence of a case-insensitive string
Stripslashes-Un-quote string quoted with addslashes ()
Stristr-Case-insensitive strstr ()
Strlen-Get string length
Strnatcasecmp-Case insensitive string comparisons using a "natural order" algorithm
Strnatcmp-String comparisons using a "natural order" algorithm
Strncasecmp-Binary safe case-insensitive string comparison of the first n characters
Strncmp-Binary safe string comparison of the first n characters
Strpbrk-Search a string for any of a set of characters
Strpos-Find position of first occurrence of a string
Strrchr-Find the last occurrence of a character in a string
Strrev-Reverse a string
Strripos-Find position of last occurrence of a case-insensitive string in a string
Strrpos-Find position of last occurrence of a char in a string
Strsps-find length of initial segment matching mask
Strstr-Find first occurrence of a string
Strtok-Tokenize string
Strtolower-Make a string lowercase
Strtoupper-Make a string uppercase
Strtr-Translate certain characters
Substr_compare-Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters
Substr_count-Count the number of substring occurrences
Substr_replace-Replace text within a portion of a string
Substr-Return part of a string
Trim-Strip whitespace (or other characters) from the beginning and end of a string
Ucfirst-Make a string's first character uppercase
Ucwords-Uppercase the first character of each word in a string
Vfprintf-Write a formatted string to a stream
Vprintf-Output a formatted string
Vsprintf-Return a formatted string
Wordwrap-Wraps a string to a given number of characters using a string break character
Base64_decode-decodes data encoded with MIME base64
Base64_encode-encode data using MIME base64
Get_headers-get all headers sent by the server in response to an HTTP request
Get_meta_tags-extract all meta tag content attributes from a file and return an array
Http_build_query-request string generated after URL-encode
Parse_url-parses the URL and returns its components
Rawurldecode-decode the encoded URL string
Rawurlencode-encode the URL according to RFC 1738
Urldecode-decode the encoded URL string
Urlencode-encode a URL string
Debug_zval_dump-Dumps a string representation of an internal zend value to output
Alias of doubleval-floatval ()
Empty-check whether a variable is empty
Floatval-get the floating point value of the variable
Get_defined_vars-returns an array consisting of all defined variables.
Get_resource_type-returned resource type
Gettype-get the variable type
Import_request_variables-import GET/POST/Cookie variables to the global scope
Intval-obtains the integer of a variable.
Is_array-check whether the variable is an array
Is_binary-Finds whether a variable is a native binary string
Is_bool-check whether the variable is Boolean
Is_buffer-Finds whether a variable is a native unicode or binary string
Is_callable-check whether the parameter is a valid callable structure
Is_double-is_float () alias
Is_float-check whether the variable is floating point type
Is_int-check whether the variable is an integer
Is_integer-is_int () alias
Alias of is_long-is_int ()
Is_null-check whether the variable is NULL
Is_numeric-check whether the variable is a numeric or numeric string
Is_object-check whether the variable is an object
Alias of is_real-is_float ()
Is_resource-check whether the variable is of the resource type
Is_scalar-check whether the variable is a scalar
Is_string-check whether the variable is a string
Is_unicode-Finds whether a variable is a unicode string
Isset-check whether the variable is set
Print_r-prints easy-to-understand information about variables.
Serialize-generate a representation of a stored value
Settype-set the variable type
Strval-get the string value of the variable
Unserialize-create a PHP value from a stored representation
Unset-release given variables
Var_dump-prints information about a variable.
Var_export-string representation of the output or returned variable
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.