| Tutorials Main Latest Tutorials Popular Tutorials Top Rated Tutorials |
| Login to See your Favorite Tutorials |
| Description: This short function will return the directory name of the current directory the script is running in. | |
| Version: 1.0 | |
| Added on: 27 June 2007 | |
| Author: floppy | |
| Difficulty Level: Very Easy | |
| Views: 734 | |
You could easily plug this into any script to return the current directory name. Extremely useful.
| Code: |
| function getCurrentDirectory() {
$path = dirname($_SERVER['PHP_SELF']); $position = strrpos($path,'/') + 1; return substr($path,$position); } |