I know DIRECTORY_SEPARATOR,
However: 1. Long write
Laziness is never a reason for anything
$path = (DIRECTORY_SEPARATOR === '\\') ? str_replace('/', '\\', $subject) : str_replace('\\', '/', $subject);
or
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
This will replace the βrightβ one in one step, but it does not matter.
If you know for sure that a path exists, you can use realpath ()
$path = realpath($path);
However, this is not required at all, since each OS understands that the forward slash / is a valid directory separator (even windows).
King crunch
source share