_php examples of common functions in PHP based on review

Source: Internet
Author: User
Tags flush generator session id mysql client mysql host mysql query natural logarithm square root
array_change_key_case-returns an array with a string key that is all lowercase or uppercase
array_chunk-to split an array into multiple
Array_combine-creates an array with 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-the difference set of an array computed with an index check
array_diff_key-the difference set of an array using a key name comparison
array_diff_uassoc-an index check using user-supplied callback functions to compute the difference set of an array
array_diff_ukey-Comparison of a key name with a callback function to compute the difference set of an array
array_diff-Calculating the difference set of an array
Array_fill_keys-fill an array with values, specifying keys
Array_fill-fills the array with the given value
Array_filter-using callback functions to filter cells in an array
array_flip-the keys and values in the swap array
array_intersect_assoc-the intersection of computed arrays with index checking
Array_intersect_key-computes the intersection of an array using a key name comparison
array_intersect_uassoc-the intersection of computed arrays with index checking, using callback functions to compare indexes
Array_intersect_ukey-computes the intersection of an array using a callback function to compare the key name
array_intersect-compute the intersection of arrays
array_key_exists-checks whether the given key name or index exists in the array
array_keys-returns all the key names in the array
Array_map-the callback function to the cell of the given array
Array_merge_recursive-recursively merges one or more arrays
array_merge-merge one or more arrays
array_multisort-to sort multiple arrays or multidimensional arrays
Array_pad-fills an array to a specified length with a value
array_pop-the last cell of the array (out of stack)
Array_product-calculates the product of all the values in an array
array_push-one or more cells into the end of the array (into the stack)
array_rand-one or more cells randomly from an array
Array_reduce-the array to a single value using the callback function iteratively
array_reverse-returns an array of cells in reverse order
array_search-searches the array for a given value and returns the corresponding key name if successful
Array_shift-the cells at the beginning of the array by moving the group
Array_slice-a paragraph from the array
Array_splice-the part of the array and replaces it with other values.
array_sum-computes the value of all values in the array
array_udiff_assoc-the difference set of an array with an index check to compare data with a callback function
array_udiff_uassoc-the difference set of an array with an index check to compare data and indexes with a callback function
Array_udiff-uses callback functions to compare data to compute the difference set of an array
array_uintersect_assoc-with index checking the intersection of arrays, using callback functions to compare data
array_uintersect_uassoc-with index checking the intersection of arrays, comparing data and indexes with callback functions
Array_uintersect-computes the intersection of arrays, using callback functions to compare data
array_unique-the duplicate values in the divisor group
array_unshift-inserts one or more cells at the beginning of an array
array_values-returns all the values in the array
array_walk_recursive-user functions recursively in each member of an array
array_walk-apply user functions to each member in an array
array-Create a new array
arsort-an array to reverse sort and keep an indexed relationship
Asort-an array to sort and keep an indexed relationship
Compact-creates an array, including variable names and their values.
count-calculate the number of cells in an array or the number of attributes in an 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-the internal pointer of an array to the last cell
extract-import variables from an array into the current symbol table
in_array-Check to see if a value exists in the array
Key-gets the key name from the associative array
krsort-Arrays in reverse order by key name
ksort-Array by Key name
List-assigns the values in the array to some variables
natcasesort-sorting by using the "natural sort" algorithm for case-insensitive alphabetical groups
natsort-sorting with the "natural sort" algorithm
next-moves the internal pointer in the array forward one
Alias for Pos-current ()
prev-the internal pointer of an array back to a
Range-set up an array containing the specified range of cells
Reset-the internal pointer of an array to the first cell
Reverse ordering of rsort-pairs of groups
shuffle-the array
Alias for Sizeof-count ()
sort-Array Sorting
Uasort-uses the user-defined comparison function to sort the values in the array and keep the index associated
Uksort-uses the user-defined comparison function to sort the key names in the array
usort-use the user-defined comparison function to sort the values in the array
Call_user_method_array-calls a user method, passing a parameter array (deprecated)
Call_user_method-invokes a user method on a specific object (deprecated)
class_exists-Check whether a class is defined
get_class_methods-returns an array of the class's method names
get_class_vars-returns an array of the default properties of the class
get_class-returns the class name of the object
get_declared_classes-returns an array of the names of the defined classes
get_declared_interfaces-returns an array containing all declared interfaces
get_object_vars-returns an associative array consisting of object properties
get_parent_class-returns the parent class name of an object or class
interface_exists-Check if the interface has been defined
is_a-returns TRUE if the object belongs to the class or the class is the parent of this object
is_subclass_of-returns TRUE If this object is a subclass of the class
method_exists-Check if the method of the class exists
property_exists-check whether an object or class has this property
checkdate-verify a Gregorian high date
Date_default_timezone_get-Gets the default time zone used by all date-time functions in a script
date_default_timezone_set-Sets the default time zone for all date-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-to get the current time
gmdate-format a GMT/UTC date/time
gmmktime-UNIX time stamp with GMT date
gmstrftime-format GMT/UTC Time/date according to locale
idate-format a local time date as an integer
localtime-Get local time
microtime-returns the current Unix timestamp and microsecond number
mktime-to get a date on a Unix timestamp
strftime-format local time/date according to locale
strptime-resolves the date/time generated by strftime ()
strtotime-resolves a date-time description of any English text to a Unix timestamp
time-returns the current Unix timestamp
chdir-Change Directory
chroot-Change the root directory
Dir-directory class
closedir-Close Directory Handle
Getcwd-get Current working directory
opendir-Open Directory Handle
readdir-read entries from a directory handle
rewinddir-back to directory handle
scandir-lists the files and directories in the specified path
basename-returns the file name part of the path
chgrp-change the group to which the file belongs
chmod-Change File Mode
chown-change the owner of the file
clearstatcache-Purge file state cache
copy-Copy Files
delete-See unlink () or unset ()
dirname-returns the directory part of the path
disk_free_space-returns the available space in the catalog
disk_total_space-returns the total disk size of a directory
Alias for Diskfreespace-disk_free_space ()
fclose-closes an open file pointer
feof-the test file pointer to the end of the file
fflush-output The buffered content to a file
Fgetc-reads characters from the file pointer
Fgetcsv-reads a line from the file pointer and resolves the CSV field
Fgets-reads a row from the file pointer
Fgetss-reads a row from the file pointer and filters out the HTML markup
file_exists-check whether a file or directory exists
file_get_contents-reads the entire file into a string
File_put_contents-writes a string to a file
File-reads the entire file into an array
Fileatime-last access time for files
Filectime-Gets the Inode modification time of the file
filegroup-the group that gets the file
Fileinode-get the inode of the file
filemtime-Get File modification time
Fileowner-gets the owner of the file
fileperms-permission to obtain files
filesize-Get File size
filetype-Get file type
flock-Lightweight Consultation File lock
fnmatch-match filename with pattern
fopen-open a file or URL
fpassthru-all remaining data at the output file pointer
fputcsv-the row into CSV and writes the file pointer
Alias for Fputs-fwrite ()
fread-read files (can be used securely in binary files)
fscanf-format input from a file
fseek-position in file pointer
fstat-access to file information through an open file pointer
ftell-returns the location of the file pointer read/write
ftruncate-the file to a given length
fwrite-Write to file (safe for binary files)
glob-find a file path that matches the pattern
is_dir-determine if a given file name is a directory
is_executable-to determine if a given file name is executable
is_file-to determine if a given file name is a normal file
is_link-determines whether a given file name is a symbolic connection
is_readable-to determine if a given file name is readable
is_uploaded_file-to determine if the file was uploaded via an HTTP POST
is_writable-to determine if a given filename is writable
Alias for Is_writeable-is_writable ()
Lchgrp-changes Group Ownership of Symlink
Lchown-changes user ownership of Symlink
link-Establish a hard connection
Linkinfo-to get a connection information
Lstat-gives information about a file or symbolic connection
mkdir-New Directory
Move_uploaded_file-move uploaded files to a new location
parse_ini_file-resolves a configuration file
pathinfo-returns the file path information
pclose-shutdown 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 canonical absolute path name
rename-rename a file or directory
Rewind-back to the location of the file pointer
rmdir-Delete Directory
Alias for Set_file_buffer-stream_set_write_buffer ()
stat-gives the file information
symlink-to establish a symbolic connection
tempnam-to create a file with a unique file name
tmpfile-Create a temporary file
touch-settings file access and modification time
umask-Change the current umask
unlink-Delete Files
mail-Send mail
abs-Absolute Value
acos-Anti-cosine
acosh-Inverse hyperbolic cosine
asin-anyway Chord
asinh-Inverse hyperbolic sine
atan2-two-parameter tangent
atan-anyway cut
atanh-Inverse hyperbolic tangent
Base_convert-converts numbers between arbitrary systems
bindec-binary conversion to decimal
Ceil-into one method to take the whole
cos-cosine
cosh-Hyperbolic cosine
decbin-Decimal conversion to Binary
dechex-decimal conversion to hexadecimal
decoct-Decimal conversion to octal
deg2rad-converts an angle to radians
Exp-calculates the index of E
Expm1-returns exp (number) –1, even when the value of number is close to 0 to calculate the exact result
Floor-the method of rounding out
Fmod-to return the floating-point number remainder of division
getrandmax-display the maximum possible value of random number
hexdec-16 Convert to Decimal
Hypot-calculates the hypotenuse length of a corner triangle
Is_finite-judge whether it is a finite value
Is_infinite-Determine whether it is an infinite value
is_nan-judge whether it is a legal value
lcg_value-Combination Linear congruence generator
log10-with a 10-base logarithm
log1p-returns log (1 + number), even when the value of number is close to 0 to calculate the exact result
log-Natural logarithm
max-Find the maximum value
min-Find the Minimum value
mt_getrandmax-display the maximum possible value of random numbers
mt_rand-to generate better random numbers
Mt_srand-to sow a better random number generator seed
octdec-octal conversion to decimal
pi-Get pi Value
pow-exponential expression
Rad2deg-converts the number of radians to the corresponding number of angles
Rand-produces a random integer
round-the floating-point numbers
sin-sine
sinh-hyperbolic sine
sqrt-Square Root
Seed of random number generator under srand-sowing
tan-Tangent
tanh-Hyperbolic tangent
mysql_affected_rows-the number of record rows affected by the previous MySQL operation
mysql_change_user-change the user who is logged on in the active connection
mysql_client_encoding-returns the name of the character set
mysql_close-Close MySQL Connection
Mysql_connect-Open a connection to the MySQL server
mysql_create_db-Create a new MySQL database
mysql_data_seek-A pointer to move the inner result
mysql_db_name-Obtain the result data
mysql_db_query-Send a MySQL query
mysql_drop_db-Discard (delete) a MySQL database
Mysql_errno-returns the digital encoding of the error message in the previous MySQL operation
mysql_error-returns the text error message from the previous MySQL operation
Mysql_escape_string-escapes a string for mysql_query
Mysql_fetch_array-takes one row from the result set as an associative array, or an array of numbers, or both
Mysql_fetch_assoc-gets one row from the result set as an associative array
mysql_fetch_field-gets column information from the result set and returns as an object
Mysql_fetch_lengths-gets the length of each output in the result set
Mysql_fetch_object-gets one row from the result set as an object
Mysql_fetch_row-takes one row from the result set as an enumeration array
Mysql_field_flags-the flags that are associated with the specified field from the result
mysql_field_len-returns the length of the specified field
Mysql_field_name-Gets the field name of the specified field in the result
mysql_field_seek-set the pointer in the result set to the Set field offset
Mysql_field_table-gets the name of the table that contains the specified field
Mysql_field_type-gets the type of the field specified in the result set
mysql_free_result-Release 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-gets the ID generated by the previous insert operation
mysql_list_dbs-lists all the databases in the MySQL server
mysql_list_fields-lists the fields in the MySQL results
mysql_list_processes-List the MySQL process
mysql_list_tables-lists the tables in the MySQL database
Mysql_num_fields-gets the number of fields in the result set
mysql_num_rows-the number of rows in the result set
mysql_pconnect-open a persistent connection to the MySQL server
Mysql_ping-ping a server connection and reconnect if there is no connection
mysql_query-Send a MySQL query
Mysql_real_escape_string-the special characters in the string used in the escape SQL statement, taking into account the current character set of the connection
mysql_result-Obtain the result data
mysql_select_db-Choose MySQL Database
mysql_stat-Get current system state
mysql_tablename-Get Table name
Mysql_thread_id-returns the ID of the current thread
Mysql_unbuffered_query-sends a SQL query to MySQL and does not get and cache the results of the row
flush-Refresh 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 mechanism
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
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 cells that match the pattern
Preg_last_error-returns the error code of the last PCRE regex execution
preg_match_all-for global Regular expression matching
preg_match-for regular expression matching
Preg_quote-Escape Regular Expression characters
Preg_replace_callback-performs search and replace of regular expressions with callback functions
Preg_replace-performs search and replace of regular expressions
Preg_split-split strings with regular expressions
Session_cache_expire-return Current Cache Expire
Session_cache_limiter-get and/or set the current cache limiter
Alias for Session_commit-session_write_close ()
Session_decode-decodes session data from a string
Session_destroy-destroys all data registered to a
Session_encode-encodes 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 be 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
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
Session_unset-free All Sessions variables
Session_write_close-write session data and end session
ereg_replace-Regular Expression substitution
ereg-Regular expression matching
eregi_replace-Regular expression substitution without case sensitivity
eregi-regular expression matching without case sensitivity
Split-the string into an array with a regular expression
spliti-splits a string into an array with regular expressions case-insensitive
Sql_regcase-produces regular expressions for case-insensitive matching
addcslashes-use backslashes to escape characters in a string in C language style
addslashes-use backslashes to refer to strings
bin2hex-converts binary data to hexadecimal representations
Alias for Chop-rtrim ()
chr-returns the specified character
chunk_split-splits a string into small chunks
count_chars-information that returns the character used for the string
crc32-computes a crc32 polynomial of a string
Crypt-one-way string encryption (hashing)
Echo-output one or more strings
explode-use a string to split 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 a 8 bit string
Quotemeta-quote Meta characters
Rtrim-strip whitespace (or other characters) from the end of a string
Setlocale-set locale Information
Sha1_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 to 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 a 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
Strcspn-find length of initial segment not matching mask
Strip_tags-strip HTML and PHP tags from a string
Stripcslashes-un-quote string quoted with Addcslashes ()
Stripos-find position of occurrence 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 the ' the ' of the ' the '
Strncmp-binary safe string Comparison of the the ' the ' of the ' the ' the '
Strpbrk-search a string for any of a set of characters
Strpos-find position of occurrence a string
Strrchr-find the last occurrence of a character in a string
Strrev-reverse a string
Strripos-find position of occurrence of a case-insensitive string in a string
Strrpos-find position of occurrence of a char in a string
Strspn-find length of initial segment matching mask
Strstr-find Occurrence 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 out of 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-A-character uppercase
Ucwords-uppercase the 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-decoding of data encoded using MIME base64
Base64_encode-uses MIME base64 to encode data
Get_headers-gets the server to respond to all headers sent by an HTTP request
get_meta_tags-extracts all meta tag content attributes from a file and returns an array
http_build_query-the request string after generating Url-encode
parse_url-resolves the URL and returns its components
rawurldecode-decoding of encoded URL strings
rawurlencode-to encode URLs according to RFC 1738
urldecode-decoding of encoded URL strings
urlencode-encoded URL string
Debug_zval_dump-dumps a string representation of internal Zend value to output
Alias for Doubleval-floatval ()
empty-Check if a variable is empty
Floatval-gets the floating-point value of a variable
get_defined_vars-returns an array of all defined variables
get_resource_type-return Resource (Resource) type
Gettype-gets the type of the variable
import_request_variables-to import Get/post/cookie variables into the global scope
intval-gets the integer value of the variable
is_array-detect whether the variable is an array
Is_binary-finds whether a variable is a native binary string
is_bool-detect whether a variable is a Boolean
Is_buffer-finds whether a variable is a native Unicode or binary string
Whether the is_callable-detection parameter is a valid callable structure
Alias for Is_double-is_float ()
Is_float-detect whether a variable is a floating-point type
is_int-detect whether a variable is an integer
Alias for Is_integer-is_int ()
Alias for Is_long-is_int ()
is_null-detect whether the variable is null
is_numeric-detect whether a variable is a numeric or numeric string
Is_object-detect whether a variable is an object
Alias for Is_real-is_float ()
is_resource-detect whether a variable is a resource type
is_scalar-detect whether a variable is a scalar
is_string-detect whether a variable is a string
Is_unicode-finds whether a variable is a Unicode string
Isset-detect whether the variable is set
print_r-Print Easy to understand information about variables.
Serialize-produces a representation of a value that can be stored
settype-set the type of variable
Strval-gets the string value of a variable
unserialize-create PHP values from stored representations
Unset-frees the given variable
var_dump-related information about printing variables
var_export-output or returns a string representation of a variable

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: info-contact@alibabacloud.com 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.