$STR = ' array 1, array 2, array 3, array 4 ';
$array = Explode (', ', $str); Depositing a regular string into an array
The explode () function splits the string into arrays.
Grammar
Explode (separator,string,limit) parameter description
Separator required. Specifies where to split the string.
string is required. The string to split.
Limit is optional. Specifies the maximum number of array elements that are returned.
$array = Array_diff ($array, Array (' Arrays 2 ')); Deletes an array item of the specified value
The Array_diff () function compares two or more arrays, and returns the keys and values in an array that are not present in the second array if the key or value in the first array does not appear in the second array.
Syntax
Grammar
Array_diff (Array1,array2,array3 ...)
Parameter
Parameter description
Describe
Array1 required. The first array is the array, the others would be compared with
Necessary parameters. Specify the first base array to participate in the comparison
Array2 required. An array to being compared with the first array
Necessary parameters. Specify a second array compared to the first array
Array3 Optional. An array to being compared with the first array
Optional parameters. Specify a third array compared to the first array
$str = Implode (', ', $array); To save an array as a regular string
The implode () function combines array elements into a single string.
Grammar
Implode (separator,array) parameter description
Separator is optional. Specifies what is placed between the elements of the array. The default is "" (an empty string).
Array required. An array to combine as a string.
Description
Although the separator parameter is optional. However, for backwards compatibility, it is recommended that you use two parameters.
Echo $str;
http://www.bkjia.com/PHPjc/445365.html www.bkjia.com true http://www.bkjia.com/PHPjc/445365.html techarticle $str = array 1, array 2, array 3, array 4, $array = Explode (,, $str);//Put the string into array explode () function to divide the strings into arrays. Grammar explode (Separator,string,li ...