Join -- convert the array into a string. the alias of the implode () function is explode ([separator], arr), which is used to split a string according to the specified rule. the returned value is an array.
I. array processing functions: [Focus 1]
Implode (separator, str) concatenates array value data by specified characters
Join -- convert an array into a string, alias of the implode () function
Explode ([separator], arr) splits a string according to the specified rule. the returned value is an array.
Count (arr) calculates the number of units in the array or the number of attributes in the object.
Is_array (arr) checks whether the variable is an array.
Sort arrays by sort (arr)
Array_unique (arr) removes repeated values from the array
Array_push (arr, str) pushes one or more units to the end of the array (in the stack)
Array_flip (arr) swap the keys and values in the array
Key (arr) returns the key name of the current element in the array.
The internal pointer of the reset (arr) array points to the first unit.
Array_chunk () splits an array into multiple
Array_search () searches for a given value in the array. if the value is successful, the corresponding key name is returned.
Array_merge () combines one or more arrays
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_values () returns all values in the array.
Array_keys () returns all the key names in the array.
II. string processing functions: [Key 2]
Trim (str) removes spaces on both sides of the string
Substr (str, start, length) intercepts the characters of the specified length in the specified string ////////////////////
Str_replace (search, replace, str) string replacement
Str_ireplace -- matches and replaces strings like the str_replace () function, but is case insensitive.
Strpos (str, search) searches for the position of the first occurrence of a character in a string
Stripos -- locate and return the position of the first matching item. the matching is case insensitive.
Strchr is the alias of strstr ().
Strlen (str) returns the string length.
The strcmp (str1, str2) function is used to compare two strings.
The strstr (str, search) function is used to obtain the substring from the first occurrence of a specified string to the end of the string.
Stristr -- same as strstr (). The difference is that it is case insensitive.
Strchr () -- alias of strstr () function
Strrchr -- returns the part of a string through comparison from the back to the back
The substr_count () function retrieves the number of times that a substring appears.
Ucfirst (str) capital the first character of the string
Ucwords (str) upper the first letter of each character in the string
Strtolower -- convert string to lowercase
Strtoupper -- converts a string to uppercase
Addslashes -- escape characters in a string in a specified way
Stripslashes -- returns the string that has been escaped by the implicit addslashes () function.
Md5-encrypt a string using the MD5 algorithm
Str_repeat -- repeat the string
Str_split -- splits a string into an array based on the character spacing
Strip_tags -- remove the HTML and PHP code in a string
Strrev -- reverse arrange all letters in the string
Substr_replace -- replace some characters in the string
Mb functions
III. Regular expression-related string functions:
Preg_match (pattern, subject, matches) searches the subject string for the content that matches the regular expression given by pattern. the matched results are stored in matches, matches [0] matches all content, matches [1] matches [1] matches second mode unit, and so on.
Preg_match_all (pattern, subject, matches) Global match. the rest of the preg_match functions are similar.
Preg_replace (pattern, replacement, str) searches and replaces regular expressions. three [string, string] [array, string] [array, array]
Preg_split ()
Preg_split (pattern, str) use regular expressions to split strings
Preg_grep (pattern, array) matches the value of an array with a regular expression and returns a new array information.
IV. mysql database functions: [Key 3]
Mysql_connect (host, user name, password) opens a connection to the MySQL server
Mysql_select_db (database, connect to database resources) select MySQL database
Mysql_query ("set names utf8"); sets the character set
Mysql_close (Connect to database resources) close the MySQL link
Mysql_query (statement) sends a MySQL Query
Mysql_fetch_row (result resource) obtains a row of results (index array) from the result set)
Mysql_fetch_assoc (result resource) obtains a row of results (associated array) from the result set)
Mysql_fetch_array (result resource) get a row of results from the result set (index/Associated array)
Mysql_fetch_object (result resource) obtains a row of results (object array) from the result set)
Mysql_free_result (result resource) release result set
Mysql_num_rows (result resource) is used to calculate the number of rows in the query result.
Mysql_affected_rows () obtain the number of affected results
Mysql_insert_id () returns the automatically increasing ID value generated by the last INSERT command
Mysql_result (result set, number of records, column name)
V. file processing functions: [secondary]
Whether the file_exists (filename) file or directory exists
Filesize (filename) get the file size
Pathinfo (filename) returns the associated array of the directory name, basic name, and extension.
Mkdir (dirname) to create a directory
Rmdir (dirname) deletes an empty directory
Fopen (filename, mode) open the file
Fclose (fp) close the file
Fwrite (fp, str, length) writes data to a file
File_put_contents (filename, content) stores the content as a file
File_get_contents (filename) reads content from the file. The actual usage of this function is high.
Fread (fp, length) reads files
Fgets () reads a row from the object pointer
Fgetc () reads characters from the object pointer
File () reads the entire file into an array. each unit in the array is a corresponding row in the file.
Readfile () reads a file and writes it to the output buffer.
Copy (filename1, filename2)
Unlink (filename) deletes a file
Rename (filename1, filename2) rename a file or directory
Class method:
Get_object_vars () returns an associated array composed of object attributes.