Fifth chapter (1) method of declaring strings
The definition of the string:
Double quote "" 1. You can execute variable 2 in double quotes. You can use the escape character
Single quote ' 1. Cannot execute variable 2 in single quotes. Only partial escape characters can be used
Inverted quotation mark ' 1. The command for the server is used in inverted quotes
Delimiters <<< 1. Same as double quotes, but can use any number of double quotes inside
Fifth chapter (2) Application of string processing function
Write functions need to know several aspects of information:
1. Functions of Function Introduction
2. Several parameters are required, the type of each parameter, those parameters are required, and those parameters are optional
3. Return value of function, type of return value
echo can output parameters of any type, or it can output multiple.
Print can only output one parameter, but has a return value of 1 0.
Die the output and exits the program.
printf can be output in any format.
sprintf first save, then output.
Var_dump the type of the detection string and the debugger.
LTrim Remove the left space of the string.
RTrim Remove the string right space.
Trim removes the string from the left and right spaces.
Strrev the string backwards and forwards.
Strtolower converts a string to a lowercase function.
Stroupper converts a string to an uppercase function.
Strlen to find the string length.
Ucfirst the first character in the string to uppercase.
Explode (1) with what Division 2. The thing to be segmented 3. To split into several parts to fill in a few. Use a string to split another string.
Implode (1. With what Union 2. What to unite) create a large string with a smaller set of strings. Alias join.
SUBSTR (1. What to take 2.) returns a string from the beginning to the end of a string in a string. Alias Atrchr.
Strpos (1) in which to find 2. What you're looking for. 3. Search for the first occurrence of a character in a string, starting with the first few.
Strrpos (1) in which to find 2. What to look for the last occurrence of a character in a string.
STRRCHR (1. What to take 2.) returns the string at which a character in the string last appears to end.
Str_pad (1) The string to be populated 2. Fill to the number of bits 3, fill what 4. Fill function that fills the strings of the Str_pad_leet left STR_PAD_RIGNT to the right str_pad_both side.
Comparison of strings:
Compare by Byte
STRCMP is case-sensitive. STRCASECMP is not case-sensitive.
STRNATCMP A string comparison according to the natural sorting method.
Fuzzy Comparison of strings
Soundex is compared by pronunciation code.
Similar_twxt are compared by the number of matches.
Str_replace (1. Something to replace 2. Replace the thing 3. What's inside to replace) replace.
STRTR (1) What's inside of 2. Something to translate 3. Translated into something) a translation function of a string.
Functions to process HTML with functions in PHP:
Stripslashes remove backslash characters.
Addslashes uses a backslash to refer to a string.
Htmlentities makes HTML tags not work, direct output. Alias Htmlspecialchars.
Strip_tags deletes and filters HTML tags.
Sixth chapter (1) Statement and application of PHP array
What is an array: An array is a variable that can store a group or series of arrays.
The characteristics of the array: 1. Any type of data can be stored.
2. Length can be longer.
Array declaration: 1.$ array variable name [index value] = data content.
2.$ array variable name = Array (data grooming, material content ...).
A multidimensional Array declaration: Array (Array (), array ()), array ()).
The PHP array is divided into two categories:
1. Indexed array: The index value of an array is an integer, starting with 0.
2. Associative array: Array with string as index value.