Return an imploded string from a multi dimensional array.

@param string $glue
@param array  $array

@return string
546267
public static function recursiveImplode($glue, array $array)
    {
        $return = '';
        $index  = 0;
        $count  = count($array);

        foreach ($array as $piece) {
            if (is_array($piece)) {
                $return .= self::recursiveImplode($glue, $piece);
            } else {
                $return .= $piece;
            }

            if ($index < $count - 1) {
                $return .= $glue;
            }
            ++$index;
        }

        return $return;
    }
578791
public static function implodeNames($glue, $terms)
    {
        if ($terms==null || empty($terms) || is_wp_error($terms)) return '';

        $tokens = array();
        foreach ($terms as $t)
        {
            $tokens[] = $t->name;
        }

        return implode($glue, $tokens);
    }
1040289
private function phpEncodeArray(array $array)
    {
        $isPlainArray = function (array $value) {
            return ((count($value) === 0)
                || (
                    (array_keys($value) === range(0, count($value) - 1))
                    && (0 === count(array_filter(array_keys($value), 'is_string'))))
            );
        };

        if ($isPlainArray($array)) {
            return '['.implode(', ', array_map([$this, 'phpEncodeValue'], $array)).']';
        }

        return '['.implode(', ', array_map(function ($key) use ($array) {
            return $this->phpEncodeValue($key).' => '.$this->phpEncodeValue($array[$key]);
        }, array_keys($array))).']';
    }
549832
public function joinString($join=null, $glue=", ")
    {
        $join = LambdaUtils::toSelectCallable($join);
        $temp = $this->select($join)->toArray();
        return implode($glue, $temp);
    }
448839
protected function quoteArray(array $array)
    {
        array_walk(
            $array,
            function (&$value) {
                $value = $this->entityManager->getConnection()->quote($value);
            }
        );

        return implode(', ', $array);
    }
346659
public function implodeKeys(string $glue = ''): string
    {
        return $this->implode_recursive($glue, $this->getArray(), true);
    }
968133
public static function getValue(&$array, $pattern)
    {
        $imploded = ArrDots::implode($array);
        $pattern  = sprintf('/^%s$/', str_replace(static::WILD, '[0-9]+', $pattern));

        foreach ($imploded as $attribute => $value) {
            if (preg_match($pattern, $attribute) == 0) {
                continue;
            }

            return $value;
        }

        return null;
    }
1374498
protected function buildMapDefinitions(array $array) {
		$result = [];
		foreach ($array as $alias => $value) {
			$result[] = "\t\t\t" . "'" . str_replace("'", "\'", $alias) . "' => " . $value . ',';
		}

		return implode(PHP_EOL, $result);
	}
1355332
public function join(string $glue = ' '): Str
    {
        return new Str(implode($glue, $this->values()->toArray()));
    }
1295263
public static final String implodeParams(final Object[] params, final String glue) {

       String returnValue = "";

       if (params.length == 1) {
           return params[0].toString();
       }

       returnValue += params[0];

       for (int i =1; i < params.length; i++) {
           returnValue += glue + params[i].toString();
       }

       return returnValue;
   }
532267
public  function join($glue, array $array)
	{
		//set the method argument values
		$this->setMethodArgs('glue', $glue);

		//set the inputElement property
		$this->inputElement = $array;

		//explode this string and set the value of $outputElement
		$this->outputElement = implode($glue, $array);

		//return the self same class
		return $this;

	}
1239053
protected function arrayToKey(array $array)
    {
        if ($this->isSequential($array)) {
            return $this->sequentialArrayToKey($array);
        }

        $parts = [];

        $keys = array_keys($array);
        sort($keys);

        foreach ($keys as $key) {
            $parts[] = $key;
            $parts[] = $this->castArrayValue($array[$key]);
        }

        return implode('_', $parts);
    }
470303
protected function implodeArray(array $array)
    {
        $results = [];

        foreach ($array as $key => $value) {
            if (is_string($key)) {
                $results[] = "'".$key."' => '".$value."'";
            } else {
                $results[] = "'".$value."'";
            }
        }

        return count($results) > 0 ? implode(', ', $results) : '';
    }
679588
public function implode(string $glue = ''): string
    {
        return $this->implode_recursive($glue, $this->getArray(), false);
    }
201681
public function join(array $array, string $separator = ','): string
    {
        $result = '';

        foreach ($array as $item) {
            if (is_array($item)) {
                $result .= $this->join($item, $separator) . $separator;
            } else {
                $result .= $item . $separator;
            }
        }

        $result = substr($result, 0, 0 - strlen($separator));

        return $result;
    }
526040
static public function implode($glue, $data)
	{
	    if (is_array($data)) {
	        if (is_array(current($data))) {
	            foreach ($data as $k => $v) {
	                $data[$k] = implode($glue, $v);
	            }
	        }
	        
	        return implode($glue, $data);
	    }
	    return $data;
	}
1196059
public static function listing($items, $glue = ' &amp; ', $sep = ', ') {
        if (is_array($items)) {
            $lastItem = array_pop($items);

            if (count($items) === 0) {
                return $lastItem;
            }

            $items = implode($sep, $items);
            $items = $items . $glue . $lastItem;
        }

        return $items;
    }