I'll set the scene...
- I've got a file example.php
- That particular file is in a folder called test
- The full file path is /root/user/website/htdocs/test/example.php
What I'd like is to echo the directory the file is in ie. test
I've managed to do this by reading the functions and creating the script below, is this a bad way of going about this? is there an easier way?
<?php
$dir_array = explode('/', getcwd());
$dir_current = end($dir_array);
echo $dir_current;
?>
outputs test
Thanks in advance.