Snippet Name: Get Current Directory Name Description: This gets the name of the directory which contains the current script. Also see:» Show the current season (spring, summe... » Saving Remote Images With PHP » Include All Files In A Directory » More File Type Detection in PHP » Get Current Page URL » Get Current Directory Name » Measure script run time » Random Image from Directory » USERS: view currently connected users » 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 file » Current_timestamp » Date Functions: Current_date » Protect Writable Directory » Directory Listing #2 » Directory Listing » Count lines in file » Copy File From Server » Delete all files in directory Comment: (none) Language: PHP Highlight Mode: PHP Last Modified: May 27th, 2009
Description: This gets the name of the directory which contains the current script.
Also see:» Show the current season (spring, summe... » Saving Remote Images With PHP » Include All Files In A Directory » More File Type Detection in PHP » Get Current Page URL » Get Current Directory Name » Measure script run time » Random Image from Directory » USERS: view currently connected users » 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 file » Current_timestamp » Date Functions: Current_date » Protect Writable Directory » Directory Listing #2 » Directory Listing » Count lines in file » Copy File From Server » Delete all files in directory
FUNCTION getCurrentDirectory() { $path = DIRNAME($_SERVER['PHP_SELF']); $position = STRRPOS($path,'/') + 1; RETURN SUBSTR($path,$position); }