PHP - implode
Trieda
Metóda - implode
(PHP 4, PHP 5, PHP 7)
implode() is the opposite of the explode() function
. It allows wrapping an array into a string.
Procedurálne
- function implode (string $glue, array $pieces) : string
- function implode (string $glue, array $pieces) : string
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $glue | string | The so-called glue, i.e. a separator of individual values in the returned string. | |
| $pieces | array | An array with values. |
Mávratovej hodnoty
Vracia: string
The function returns a string containing values from an array.
Príklady
<?php
$array = ['one', 'two', 'three', 'four', 'five', 'six', 'seven'];
$s = implode(',', $array);
echo($s);
Súvisiace manuály
- function explode (string $delimiter, string $string, int $limit = PHP_INT_MAX) : array
