PHP implode Function



PHP Tutorial > String Functions > implode Function

The implode function in PHP is used to join array elements with a specified delimiter. It is the opposite of the explode function.

The syntax of the implode function is:

implode ('delimiter', $array)

delimiter is the string (can be one or more characters) used as a separator in the resulting string.

Let's take a look at the examples below:

Example 1

$array1 = array('one','two','three');
print (implode ('+',$array1));

Result:

one+two+three

Example 2

$array2 = array('alpha','beta','delta');
print (implode (' plus ',$array2));

Result:

alpha plus beta plus delta

Next: PHP md5 Function



Copyright © 2023   1keydata.com  All Rights Reserved.  Privacy Policy   About   Contact