Explode, imp: php's explode and implode: explode functions are to use one string to split another string. Returns a split array. Let's see the basic usage of explode:; print_r ($ data); echo ;? & Gt; the program output is: Array ([0] & gt; [1] & gt; aa [2] & gt; bb explode. the function is to use one string to separate another string. Returns a split array.
Let's look at the basic usage of explode:
";print_r($data);echo "
";?>
Program output:
Array
(
[0] =>
[1] => aa
[2] => bb
[3] =>
)
We can see that the first and end x of the str string is interpreted as a space, and x in the middle splits the string into two halves. If there are multiple x in the middle, the extra x is interpreted as a space.
For example, set str to xaaxxxbbx.
The program output is:
Array
(
[0] =>
[1] => aa
[2] =>
[3] =>
[4] => bb
[5] =>
)
Explode also has an optional parameter limit.
The function of limplode is to convert a one-dimensional array into a string. its basic usage is as follows:
'aa', 'b' => 'bb', 'c' => 'cc');$str = implode('x', $data);echo $str;?>Program output: aaxbbxcc
The first parameter is the connector. if it is a space, the output is aa bb cc. if the first parameter is not specified, the output is aabbcc.
The above introduces explode and implode in php, including explode and imp, and hope to help those who are interested in PHP tutorials.