Gamerz Posted August 5, 2009 Share Posted August 5, 2009 How do I get the last foldername via a php code? For example: If my directory is: /test/users/gamerz/index.php then I want the code to detect and echo out gamerz, as gamerz is the last folder name on that directory...And also I don't want the slashes (/gamerz) or (gamerz/) just plain last foldername. Link to comment https://forums.phpfreaks.com/topic/168878-solved-php-get-last-folder-name/ Share on other sites More sharing options...
smerny Posted August 5, 2009 Share Posted August 5, 2009 $current_folder = basename(dirname(__FILE__)); Link to comment https://forums.phpfreaks.com/topic/168878-solved-php-get-last-folder-name/#findComment-891019 Share on other sites More sharing options...
Gamerz Posted August 5, 2009 Author Share Posted August 5, 2009 Alright, it worked...thank u Link to comment https://forums.phpfreaks.com/topic/168878-solved-php-get-last-folder-name/#findComment-891021 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.