English
German

PHP implode

PHP Array implode

The PHP function implode operates on an array and is known as the "undo" function of explode. If you have used explode to break up a string into chunks or just have an array of stuff you can use implode to put them all into one string.


PHP implode Repairing the Damage

The first argument of implode is the string of characters you want to use to join the array pieces together. The second argument is the array (pieces).

Example:

$pieces = array("Hello", "World,", "I", "am", "Here!");

$gluedTogetherSpaces = implode(" ", $pieces);
$gluedTogetherDashes = implode("-", $pieces);
for($i = 0; $i < count($pieces); $i++){
    echo "Piece #$i = $pieces[$i] <br />";
}
echo "Glued with Spaces = $gluedTogetherSpaces <br />";
echo "Glued with Dashes = $gluedTogetherDashes";
 

The implode function will convert the entire array into a string and there is no optional argument to limit this as there was in the explode function.


PHP Tutorial,PHP implode, PHP implode example, learn PHP implode,explain example PHP implode online free training PHP Tutorial, PHP Tutorial example, learn PHP implode, online tutorial, download tutorial, PHP Tutorial books, PHP Tutorial videos, live videos PHP Tutorial, learn PHP Tutorial, PHP Tutorial topic PHP implode, live training PHP Tutorial, download free tutorial