Php implode () function description, implode Function Description

Source: Internet
Author: User
Tags php explode

Php implode () function description, implode Function Description

What is the function of php implode?

 

In php, the implode () function returns a string composed of array elements. It is opposite to the php explode () function. The php explode () function is: use one string to separate another string and return an array consisting of strings.

After learning about the functions of the php implode () function, let's take a look at the syntax of the php implode () function and its example.

Syntax

1 implode(separator,array)

Parameters:

 

Parameters Description
Separator Optional. Specifies the content to be placed between array elements. The default value is "" (Null String ).
Array Required. Array to be combined as a string.

 

Note: The implode () function accepts the order of two parameters. However, for historical reasons, explode () does not work. You must ensure that the separator parameter is prior to the string parameter.

Note: The separator parameter of the implode () function is optional. However, we recommend that you use two parameters for backward compatibility.

Example

Use different characters to separate array elements. The Code is as follows:

12345678910 <?php$arr array('Hello','World!','Beautiful','Day!');echo implode(" ",$arr)."<br>"; echo implode("+",$arr)."<br>"; echo implode("-",$arr)."<br>"; echo implode("X",$arr);?>

Code running result:

[Recommended related articles]

1. php explode () function example

2. How to Use the php explode () function

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.