Difference between revisions of "JArrayHelper/toString"
From Joomla! Documentation
< API15:JArrayHelper
(New page:
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JArrayHelper/toStr...) |
m (preparing for archive only) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <! removed transcluded page call, red link never existed > | |
− | < | ||
− | |||
− | |||
− | |||
− | |||
===Syntax=== | ===Syntax=== | ||
Line 65: | Line 60: | ||
</source> | </source> | ||
− | + | ||
− | + | <! removed transcluded page call, red link never existed > | |
− | < | ||
− | |||
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=toString | category=toString | ||
category=JArrayHelper | category=JArrayHelper | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Latest revision as of 19:18, 24 March 2017
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
<! removed transcluded page call, red link never existed >
Syntax[edit]
toString($array=null, $inner_glue= '=', $outer_glue= ' ', $keepOuterKey=false)
Parameter Name | Default Value | Description |
---|---|---|
$array | null | |
$inner_glue | '=' | |
$outer_glue | ' ' | |
$keepOuterKey | false |
Defined in[edit]
libraries/joomla/utilities/arrayhelper.php
Importing[edit]
jimport( 'joomla.utilities.arrayhelper' );
Source Body[edit]
function toString( $array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false )
{
$output = array();
if (is_array($array))
{
foreach ($array as $key => $item)
{
if (is_array ($item))
{
if ($keepOuterKey) {
$output[] = $key;
}
// This is value is an array, go and do it again!
$output[] = JArrayHelper::toString( $item, $inner_glue, $outer_glue, $keepOuterKey);
}
else {
$output[] = $key.$inner_glue.'"'.$item.'"';
}
}
}
return implode( $outer_glue, $output);
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]