Core Function JoinKV
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> JoinKV( <array>, <separator> ) </pre> === Description === Join an array (as keys and values) into a string with an optional separator. === Parameters === ==== array ===...") |
m (1 revision) |
||
(2 intermediate revisions by one user not shown) | |||
Line 33: | Line 33: | ||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
$arr = array("foo" => 1, "bar" => 2, "testingFooBar" => 3); | $arr = array("foo" => 1, "bar" => 2, "testingFooBar" => 3); | ||
− | $joined = | + | $joined = JoinKV($arr); |
PrintfC($joined); # 'foo 1 | PrintfC($joined); # 'foo 1 | ||
# bar 2 | # bar 2 |
Latest revision as of 12:37, 14 June 2015
JoinKV( <array>, <separator> )
Contents |
Description
Join an array (as keys and values) into a string with an optional separator.
Parameters
array
The array to join.
separator
Optional; A string to place between each array element.
Default is "\n" a newline.
Return Value
Success - The array merged into a string.
Failure - Returns an empty string.
Remarks
This does not alter the original array.
Example
$arr = array("foo" => 1, "bar" => 2, "testingFooBar" => 3); $joined = JoinKV($arr); PrintfC($joined); # 'foo 1 # bar 2 # testingFooBar 3'