This article is mainly to share with you the PHP part of the function of sharing, hope to help everyone.
1.Gettype (): get variable type
2.is_array (): Determines whether a variable is an array type
3.is_double (): Determines whether the variable is a double floating-point number type
4.is_float (): Determines whether the variable is a floating-point number type
5.is_int (): Determines whether the variable is an integer type
6.is_integer (): Determines whether the variable is an integer type
7.is_long (): Determine if the variable is a long integer type
8.is_object (): Determine if the variable is an object type
9.is_string (): Determine if the variable is a string type
10.Echo function: Output one or more strings
11.Print function : output one or more strings
12.Die function: The alias function of the function exit () function
13.Printf function: This function is used to output formatted string
Note: The first function is required, is the specified string, and how to format the variable.
14.Trim function: Used to remove spaces at the beginning and end of a string, and returns a string after the space is stripped .
15.Ltrim function: This function is the same as the Trim () function , removing only specific characters to the left of the string.
16.Rtrim function: This function is the same as the Trim () function to only remove specific characters to the right of the string .
17.str_pad () function: Fill the string as required
Note: The function has four parameters, the first parameter is a required option, the second parameter is also a required option, the third function specifies the string to fill with, for options, the fourth function specifies the direction to fill.
Example:$input = "Alien";
Echo Str_pad ($input, 10); Output: Alien
18.Addslashes (): Used to add escape characters to special characters in a string .
19.Strlen () function: Gets the length of the string .
20.SUBSTR () function: Returns a substring of a string .
21.NL2BR function: Insert the HTML line break "<br>" before each new line "\ n" in the string
22.htmlspecialchars () function: Convert some pre-defined characters to HTML entities
23.STRCMP (): string comparison function , string comparison by byte order
24.STRCASECMP (): string comparison functions can be compared by ignoring the case of letters in a string
25.STRNATCMP (): Compare two strings by natural sorting the function is case-sensitive and uses a formula similar to the strcmp () function
26.substr_replace: String that replaces strings.
27.Strrev: This function can easily flip a string, only valid in English
28.num_format () function: Formats a number by a thousand grouping.
29.MD5 (): A string is encrypted by the MD5 algorithm, and a 32-bit hexadecimal string is returned by default and cannot be decrypted after encryption
30.mb_strlen function: Chinese to English mixed gets the length of the string when calculating the length, the number of characters is calculated instead of the number of bytes
31.mb_substr function: String intercept
32.each function: Returns the current key/value pair in the array and moves the array pointer forward one step
33.list function: Assign the values in the array to some variables
34.explode () Function: Convert a string to an array
35.implode () function: Converts an array to a new string
36.count () function: counts the number of elements in an array or the number of attributes in an object
37.array_search () function: Querying the specified element in an array
38.array_pop function: Gets the last cell in the array
39.array_push function: Adding elements to an array
40.array_unique () function: Used to delete duplicate values in an array the function has only one parameter
41.array_rand () function: randomly extracting array elements
42.sort () Function: Key values ascending sort
43.rsort () Function: Descending order of key values
44.ksort () function: Sort from small to large in order of key name pairs
45.krsort () function: Sort from large to small in order of key names, no array retains the original key name after sorting
46.asort () function: sort the array and keep the index relationship
Arsort () function: reverse sort an array and maintain an index relationship
48.natsort () Function: Sort the array with the " Natural sort " algorithm
49.array_slice: Takes a value out of a condition in the array and returns
50.array_combine: Create a new array by merging two arrays
51.array_merge: Merging one or more arrays into an array
52.foreach: A simple way to iterate through an array, only available for arrays and objects.
53.each: Returns the current key/value of the array and moves the array pointer one step forward.
54.var_dump: Output Variable type.
55.$_server: Information about the storage server
56.$_cookie: COOKIE Information for clients
57.$_session: The SESSION information of the stored program
58.$_files: Storing basic information for uploading files
59.$_get: Store form information submitted in GET mode
60.$_post: Store form information submitted by POST
61.array_values (): get the value of an array
62.array_keys (): get the key name of the array
63.array_flip (): the values in the array are interchanged with the key names (if there are duplicates, the previous overrides will be followed)
64.in_array (): detecting a string in an array
Related recommendations:
A very useful PHP function
How to use the static variables of PHP functions
Introduction to PHP function examples