Directory Functions

Some questions about directories…

1.) Is there a function that will tell what the current directory is? (i.e. the directory the php file calling such a function is in.)

2.) Is there a function that will tell me what the highest directory is? (i.e. not necessarily “root”, but the highest folder that all of my PHP files are in. For example, I use NetBeans, and I may have a “project folder” called 01_MyFirstProject which sorta serves as root in NetBeans, but isn’t the highest folder.)

3.) Is there a function that tells me what the “Web Root” is? (e.g. on my web hosting account)

TomTees

This my helpful to your problem:
http://in3.php.net/manual/en/ref.dir.php

I thought there were some functions like {SERVER_ROOT}…

TomTees

There is DIR for the current file. Also, cwd() or realpath(“.”) for the current directory which might not be the same as that of the file being executed.

I guess you could look at the paths from get_included_files() for a common prefix.

$_SERVER[‘DOCUMENT_ROOT’] should give you that.