isLocalPath.php
Table of Contents
Functions
- isLocalPath() : bool
- Determines whether the given path refers to a local file system location.
Functions
isLocalPath()
Determines whether the given path refers to a local file system location.
isLocalPath(string $path) : bool
A path is considered "local" if:
- It is not empty.
- It does not contain a URL-like scheme (e.g.
http://
,ftp://
,s3://
, etc.).
This function uses a lightweight string check to detect the presence of ://
,
which is common in remote paths or stream wrappers.
Parameters
- $path : string
-
The path to check. Can be relative, absolute, or URL-style.
Tags
Return values
bool —True if the path is local; false if it looks like a remote or virtual path.