PHP Class 8 string splitting common functions. PHP Class 8 string splitting common functions Course Overview: This course provides basic operations on strings. string knowledge point: 1. string Processing 2. common string output PHP Lesson 8 string splitting common functions
Course Overview:
This lesson allows you to perform basic operations on strings.
String knowledge point:
1. introduction to string processing
2. common string output functions
3. common string formatting functions
4. string comparison functions
5. Application of regular expressions in strings
6. Regular expressions used with per1
1. pathinfo (); // return the path information of the domain name
2. parse_url ();
3. parse_str (); // used to split parameters
Pathinfo ();
";print_r($arr);echo "
";?>
// Split a domain name into an array
";print_r($arr4);echo "
";?>
// Obtain the same method
";print_r($arr4);echo "
";?>
// Method 3
";print_r($arr3);echo "
";?>
String knowledge point:
1. introduction to string processing
2. common string output functions
3. common string formatting functions
4. string comparison functions
5. Application of regular expressions in strings
6. Regular expressions used with per1
String functions
Echo
Print
Printf (); direct output
Sprintf (); returns directly
String connector:
. Use point connection
Print "aaaaaaaaaa ";
Printf ("---- % s -- $ s --", $ a, $ B );
% S string
% D number
% F floating point (%. 2f indicates two digits after the decimal point)
Sprintf (); no direct output. a new variable is returned.
Common string formatting functions:
1. remove spaces and strings to fill the function
1. ltrim (); // remove the left space
2. rtrim (); // remove the right space
3. trim (); // remove spaces on both sides
4. str_pad (); // used to fill in spaces or customize characters to specify the length
5. str_repeat (); // used to repeat the previous character (used to create an unlimited category menu)
6. strlen () // Obtain the string length
Echo "|". str_repeat ("-", 5). "bb ";
String case conversion function
1. strtoupper (); // Convert all to uppercase
2. strtolower (); // Convert all to lowercase letters
3. ucfirst (); // uppercase letters
4. ucwords (); // uppercase letters of each letter
Other string formatting functions:
1. strlen (); // string length
2. strrev (); // string flip
3. number_format (); // numeric character function
4. md5 // md5 encrypted string, 32-bit string
5. str_shuffle (); randomly breaks the string and the number of digits remains unchanged.
String functions:
String functions associated with html:
1. nl2br (): Converts/n to a br tag.
2. htmlspecialchars (); convert object
'"<> & Convert to entity
": Indicates an object.
<: Yu No.
>: Greater
3. addslashes () // '"\ add in front \ to reduce damage to the database
4. remove the \ above stripslashes () // '"\
3. strip_tags (); only some labels are retained and the labels you want to remove are removed.
Note: We recommend that you control the database before it is inserted into the database.
1. [B] [/B] only convert limited tags for tag filtering
2. addslashes ();
'"" \ Add in front \ to reduce damage to the database
3. htmlspecialchars ()
'"<> & Convert to an object to prevent the database from becoming any faster
Course Overview of NLP string splitting common functions: This course can be used to perform basic operations on strings. string knowledge points: 1. string processing Introduction 2. common string output...