From: Tim Otten Date: Thu, 19 Mar 2015 23:29:18 +0000 (-0700) Subject: CRM-16145 - Add CRM_Utils_File::concat() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7f616c07618e06b1c9a593160c089584462a7dbe;p=civicrm-core.git CRM-16145 - Add CRM_Utils_File::concat() --- diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php index 342751672d..73c9bf50ab 100644 --- a/CRM/Utils/File.php +++ b/CRM/Utils/File.php @@ -176,6 +176,28 @@ class CRM_Utils_File { } } + /** + * Concatenate several files. + * + * @param array $files + * List of file names. + * @param string $delim + * An optional delimiter to put between files. + * @return string + */ + public static function concat($files, $delim = '') { + $buf = ''; + $first = TRUE; + foreach ($files as $file) { + if (!$first) { + $buf .= $delim; + } + $buf .= file_get_contents($file); + $first = FALSE; + } + return $buf; + } + /** * @param string $source * @param string $destination