DIRECTORY_SEPARATOR

The DIRECTORY_SEPARATOR constant provides the character to distinguish one directory from the next, in a path.

DIRECTORY_SEPARATOR is / most of the time. On Windows, it may be \, although / is also valid at the same time, for compatibility reasons.

Using DIRECTORY_SEPARATOR to build paths or split a string into its components, means that the resulting data is valid on every underlying system.

<?php

    $path = 'folder' . DIRECTORY_SEPARATOR . 'subfolder' . DIRECTORY_SEPARATOR . 'file.txt';
    echo $path;

?>

Documentation

Related : Constants, Path, File System, Portability, PHP Constants, RecursiveDirectoryIterator