Jump to: navigation, search

Php implode

From w3cyberlearnings

Contents

PHP function implode

This function returns a string by joining all the array elements together specifies by the separator.

Syntax implode

  • separator: to separator puts between the array elements, the default value is an empty string.
  • array: array to join into string.
implode(separator, array);

Example 1

<?php
$arr = array("Great", "leader", "is", "not", "only", "lead", "but", "also", "serve");
echo implode(" ",$arr);
?>

Output

Great leader is not only lead but also serve

Example 2

<?php

$arr = array("Great", "leader", "is", "not", "only", "lead", "but", "also", "serve");
echo implode("=",$arr);
?>

Output

Great=leader=is=not=only=lead=but=also=serve

Related Functions


Navigation
Web
SQL
MISC
References