function prototypes for explode ():
Array explode (string separator,string input [, int limit]); [, int limit] is a means of optional
Parameters |
Description |
Separator |
Necessary. Specifies where to split the string. |
String |
Necessary. The string to split. |
Limit |
Optional. Specifies the maximum number of array elements that are returned. |
1<?PHP2 $array= "[Email protected]@[email protected]";3 $people=Explode(‘@‘,$array);4 5 Echo $people[0]. " <br> ".$people[1]. " <br> ".$people[2]. " <br> ".$people[3];Echo"<br>";6 7 $peoplelimit=Explode(‘@‘,$array, 3);8 9 Print_r($peoplelimit);Echo"<br>";Ten One Echo implode(‘@‘,$people);Echo"<br>"; A - Echo Join(‘**‘,$people); - the?>
The results are as follows:
Tedtinytomjson Array ([0] = ted [1] = tiny [2] = [email protected]) [email protected]@[email protected]ted# c12> #tiny # #tom # #json
It is important to note that:
The explode () function uses limit, and the subsequent ones are no longer separated by delimiters, as the remaining elements exist;
The results obtained using the join () function are not green.
Explode () with the opposite function implode () and join ()