joinPaths.php
Table of Contents
Functions
- joinPaths() : string
- Concatenates multiple path fragments into a single canonical path.
Functions
joinPaths()
Concatenates multiple path fragments into a single canonical path.
joinPaths(string ...$paths) : string
Behaviour rules
- Empty segments (
''
) are ignored. - The first non‑empty segment is kept “as‑is” so a leading slash, drive
letter (
C:/
), or scheme (phar://
) is preserved. - Every subsequent segment is joined with exactly one forward‑slash
(
/
) separator – unless the previous fragment already ends with/
or\
. - After assembly, the result is passed through canonicalizePath() to
normalise slashes and collapse
.
/..
. - If all fragments are empty, an empty string is returned.
⚠ Type‑hint fix – the function returns a string, not a bool. The signature has been updated accordingly.
Parameters
- $paths : string
-
Arbitrary number of path fragments. May contain Unix, Windows or URL‑style segments.
Tags
Return values
string —Canonical, joined path (or empty string).