getSchemeAndHierarchy.php
Table of Contents
Functions
- getSchemeAndHierarchy() : array{0: ?string, 1: string}
- Split a filename or URI into its scheme (if any) and hierarchical part.
Functions
getSchemeAndHierarchy()
Split a filename or URI into its scheme (if any) and hierarchical part.
getSchemeAndHierarchy(string $filename) : array{0: ?string, 1: string}
Logic
- Detect the first “://” only once – no array allocation if not present.
- Accept schemes that match RFC‑3986
[A‑Za‑z][A‑Za‑z0‑9+\-.]*. - Return
[$scheme, $hierarchy], where$schemeisnullwhen absent.
Parameters
- $filename : string
-
A path or URI such as
file:///tmp/app.logor/etc/hosts.