diff options
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index 13c4bb819..bc44f22f3 100644 --- a/include/text.php +++ b/include/text.php @@ -2324,6 +2324,23 @@ function stringify_array_elms(&$arr, $escape = false) { $arr[$x] = "'" . (($escape) ? dbesc($arr[$x]) : $arr[$x]) . "'"; } + +/** + * @brief Similar to stringify_array_elms but returns a string. If $escape is true, dbesc() each element before adding quotes. + * + * @param array $arr + * @param boolean $escape (optional) default false + * @return string + */ +function stringify_array($arr, $escape = false) { + if($arr) { + stringify_array_elms($arr); + return(implode(',',$arr)); + } + return EMPTY_STR; +} + + /** * @brief Indents a flat JSON string to make it more human-readable. * |