Category: >> PHP Code >> Get Current Directory Name Bookmark and Share

<< lastnext >>

Snippet Name: Get Current Directory Name

Description: This gets the name of the directory which contains the current script.

Also see:
» Active Directory - Reading the Use...
» Simple directory viewer / browser
» Read a web page directly in to a s...
» Recursive Directory Browser
» Check if current session is using ...
» Create an array from the contents ...
» Get A Directory Listing Of Specifi...
» Check If A Directory Allows File C...
» Show the current season (spring, s...
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Get Current Page URL
» Measure script run time
» Random Image from Directory
» USERS: view currently connected us...
» Database Links: CURRENT_USER
» TIMESTAMP: Get current timestamp
» Date functions: CURRENT_DATE
» Date functions: Current Date
» Show info on current context
» Write to File example
» Get oldest file in directory
» Show current time as PNG-image
» Check if a file exists
» Recursive Directory Browser
» List files in directory
» Find the current URL of the page
» Export table to Excel or MS Word f...

Comment: (none)

Author: CoderZone
Language: PHP
Highlight Mode: PHP
Last Modified: May 27th, 2009

function getCurrentDirectory() {
	$path = dirname($_SERVER['PHP_SELF']);
	$position = strrpos($path,'/') + 1;
	return substr($path,$position);
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© | users online: 8