core-bundle/src/Resources/contao/classes/Versions.php
protected function implodeRecursive($var, $binary=false)
	{
		if (!\is_array($var))
		{
			return $binary ? StringUtil::binToUuid($var) : $var;
		}
		elseif (!\is_array(current($var)))
		{
			if ($binary)
			{
				$var = array_map(function ($v) { return $v ? StringUtil::binToUuid($v) : ''; }, $var);
			}

			return implode(', ', $var);
		}
		else
		{
			$buffer = '';

			foreach ($var as $k=>$v)
			{
				$buffer .= $k . ": " . $this->implodeRecursive($v) . "\n";
			}

			return trim($buffer);
		}
	}
protected function implodeRecursive($var, $binary=false)
	{
		if (!\is_array($var))
		{
			return $binary ? StringUtil::binToUuid($var) : $var;
		}
		elseif (!\is_array(current($var)))
		{
			if ($binary)
			{
				$var = array_map(function ($v) { return $v ? StringUtil::binToUuid($v) : ''; }, $var);
			}

			return implode(', ', $var);
		}
		else
		{
			$buffer = '';

			foreach ($var as $k=>$v)
			{
				$buffer .= $k . ": " . $this->implodeRecursive($v) . "\n";
			}

			return trim($buffer);
		}
	}
Implode a multi-dimensional array recursively

@param mixed   $var
@param boolean $binary

@return string