Hi I need a command that returns the directory name that my file is in for example if my file is www/javad/codes/getdir.php , then I want to place a code in getdir.php that returns "codes" (and if possible "javad") Thanks for your help
you probably want the first line in the code below getcwd() returns the absolute path of the directory you're in. Basename gets just the innermost folder from that. echo basename(getcwd()); echo '<br />'; echo getcwd(); echo '<br />'; echo $_SERVER['PHP_SELF']; PHP:
This code outputs absolute directory path to a file it's embedded to: $mydir = dirname(__FILE__); echo $mydir; PHP: