Created
February 26, 2020 04:16
-
-
Save Grawl/f47d2f98d97b85d4da0c85eae93aa099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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