String replacement 1. execute a regular expression to search for and replace mixed preg_replace (mixed $ pattern, mixed $ replacement, mixed $ subject [, int $ limit =-1 [, int & $ count]) search for the part in the subject that matches pattern and replace it with replacement. 2. replace the child string with mixed str_replace (mixed $ search, mixed $ replace, mixed $ subject [, int & $ count]). This function returns a string or array. This string or array is the result after all the searches in the subject are replaced by replace. String separation and connection use a regular expression to separate string description 1. array preg_split (string $ pattern, string $ subject [, int $ limit =-1 [, int $ flags = 0]) separates a given string using a regular expression. 2. explode-when one string is used to separate another string, it indicates array explode (string $ separator, string $ string [, int $ limit]) $ str = 'one | two | three | four '; // positive limitprint_r (explode ('|', $ str, 2); // negative limit (from PHP 5.1) print_r (explode ('| ', $ str,-1); the preceding routine will output: Array ([0] => one [1] => two | three | four) array ([0] => one [1] => two [2] => three) 3. string implode (string glue, array pieces) // The connected array is called the string $ lan = array ("a", "B", "c"); implode ("+ ", $ lan); // a + B + c