aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-17 22:23:28 -0700
committerzotlabs <mike@macgirvin.com>2018-04-17 22:23:28 -0700
commitfc7d9c235cf845e687095d4f30d32eca4c12bc4a (patch)
treef9dfba3974b8790d232d25d19316317cb87ad308 /include/text.php
parent0f5ae5cac8770e27e815ac6558862a0fd321446d (diff)
downloadvolse-hubzilla-fc7d9c235cf845e687095d4f30d32eca4c12bc4a.tar.gz
volse-hubzilla-fc7d9c235cf845e687095d4f30d32eca4c12bc4a.tar.bz2
volse-hubzilla-fc7d9c235cf845e687095d4f30d32eca4c12bc4a.zip
minor code optimisation
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php17
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.
*