PHP Implode

The implode() function is used to combine array elements into a single string and return the string.


string implode(string glue, array array)

parameter Description
glue Character to connect to the array element
array arrays to be combined as strings

Examples of connectors are:

$array = array('name', 'phone', 'e-mail');
$char = implode(" ^ ", $array);
echo $char;

Browser output:

Name ^ Phone ^ E-mail

You can use spaces as connectors:

$char = implode(" ", $array);


  • Depending on the situation, you can select a space as a connector or a special symbol as a connector for subsequent string processing operations.
  • The connector parameter glue can be empty by default, but it is recommended to use this parameter for backward compatibility.
  • This function is safe for binary objects.

PHP join()

Join() is an alias function for implode().

The inverse of the PHP implode() function is explode(): Split a string using a split symbol and make an array.

  • PHP explode: Splits a string into an array using a split symbol.
  • PHP split: Splits a string into an array with a regular expression.

Copyright 2014-2017 by All Rights Reserved.