Skip to content

Instantly share code, notes, and snippets.

@Grawl
Created February 26, 2020 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grawl/f47d2f98d97b85d4da0c85eae93aa099 to your computer and use it in GitHub Desktop.
Save Grawl/f47d2f98d97b85d4da0c85eae93aa099 to your computer and use it in GitHub Desktop.
<?
class Util {
/**
* Join paths
*
* @param
*
* @return string
*/
public static function PathJoin() {
$args = func_get_args();
$paths = [];
foreach ($args as $arg) {
$paths = array_merge($paths, (array)$arg);
}
$paths = array_map(function ($path) {
return trim($path, '/');
}, $paths);
$paths = array_filter($paths);
return join('/', $paths);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment