normalizePath.php
Table of Contents
Functions
- normalizePath() : string
- Normalizes the given file system path by replacing backslashes with slashes.
Functions
normalizePath()
Normalizes the given file system path by replacing backslashes with slashes.
normalizePath(string $path) : string
This function is useful to unify path separators across different operating systems.
It ensures all directory separators are forward slashes (/
), making the path
suitable for consistent comparison, storage, or manipulation.
It does not resolve relative components like .
or ..
, nor does it
canonicalize or validate the path against the filesystem.
Parameters
- $path : string
-
The path to normalize. Can contain mixed or inconsistent separators.
Tags
Return values
string —The normalized path with all backslashes (\
) replaced by forward slashes (/
).