Explode () with the opposite function implode () and join ()

Source: Internet
Author: User

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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.