Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.

BeastNode

CommandHelper/Staged/API/array implode

From EngineHub.org Wiki
Jump to: navigation, search



Vital Info

Name array_implode
Returns string
Usages array, [glue]
Throws CastException
Since 3.3.0
Restricted
No
Optimizations None

Description

Given an array and glue, to-strings all the elements in the array (just the values, not the keys), and joins them with the glue, defaulting to a space. For instance array_implode(array(1, 2, 3), '-') will return "1-2-3".

Usages

array_implode(array, [glue])

Examples (How do these work?)

Example 1

Basic usage

Given the following code:

1   array_implode(array(1, 2, 3), '-')


The output would be:

:1-2-3

Example 2

With associative array

Given the following code:

1   array_implode(array(one: 'a', two: 'b', three: 'c'), '-')


The output would be:

:a-c-b


See Also

split, reg_split



Navigation menu