contains this path:
In that case you could explode the string by slashes and return the first one:
$pathInPieces = explode('/', $_SERVER['DOCUMENT_ROOT']);
This will output the server's root directory.
When you use the constant DIRECTORY_SEPARATOR instead of the hardcoded slash ('/') this code is also working under Windows.
Hope it helps!!