Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
b795dd8b
Commit
b795dd8b
authored
Jan 30, 2016
by
Carsten Rose
Browse files
onArray: enhanced phpdoc. Extended toString() with 'encloseValue'
parent
a4cddb3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
qfq/helper/OnArray.php
View file @
b795dd8b
...
...
@@ -18,16 +18,22 @@ require_once(__DIR__ . '/../../qfq/Constants.php');
class
OnArray
{
/**
* Builds a string from an assoc array.
*
* key/value are combined with $keyValueGlue.
* values are enclosed by $encloseValue.
* rows combined with $rowGlue
*
* @param array $dataArray
* @param string $keyValueGlue
* @param string $rowGlue
* @return string
*/
public
static
function
toString
(
array
$dataArray
,
$keyValueGlue
=
'='
,
$rowGlue
=
'&'
)
{
public
static
function
toString
(
array
$dataArray
,
$keyValueGlue
=
'='
,
$rowGlue
=
'&'
,
$encloseValue
=
''
)
{
$dataString
=
''
;
foreach
(
$dataArray
as
$key
=>
$value
)
{
$dataString
.
=
$key
.
$keyValueGlue
.
$
v
alue
.
$rowGlue
;
$dataString
.
=
$key
.
$keyValueGlue
.
$
encloseValue
.
$value
.
$encloseV
alue
.
$rowGlue
;
}
$glueLength
=
strlen
(
$rowGlue
);
...
...
@@ -86,4 +92,5 @@ class OnArray {
}
return
$result
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment