php implode() function


  Translation results:

UK[ɪmˈpləʊd] US[ɪmˈploʊd]

vt.& vi. (make) centripetal explosion

Third person singular: implodes Present participle: imploding Past tense: imploded past participle :imploded

php implode() functionsyntax

Function: Combine array elements into strings

Syntax: implode(separator,array)

Parameters:

Parameter Description
separator Optional. Specifies what is placed between array elements. Default is "" (empty string).
array Required. Arrays to be combined into strings.

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

php implode() functionexample

<?php
$arr = array('Hello','World!','I','love','PHP!');
echo implode(" ",$arr);
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

Hello World! I love PHP!


<?php
$arr = array('Hello','World','I','love','PHP');
echo implode("!",$arr);
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Hello!World!I!love!PHP

Home

Videos

Q&A