3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Util;
32 private function __construct () {
33 // Utitlities don't have instances
37 * Implodes recursively a multi-dimensional array where a normal implode() will fail.
39 * @param array $array Array to implode
40 * @param string $glue Glue for imploded elements
41 * @return string String with elements from array
43 public static function recursiveImplode (array $array, $glue) {
44 // Init returned string
47 // Loop through all records
48 foreach ($array as $element) {
50 if (is_array($element)) {
52 $string .= '{' . self::recursiveImplode($element, $glue) . '}' . $glue;
55 $string .= $element . $glue;
60 $string = trim($string, $glue);