Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

PHP - Get current directory - folder name only

Say I have a file called example.php

It is located in public_html/files/test/example.php

How would I print the name of the folder, "test"?

In other words, what I want to do is show the location of the file, for use in some strings and such. But instead of making 20 different files (as this file will be used in several folders) I want to be able to find out the name of the folder it is in and print that.

Say it was at www.hbgames.tk/example/gatorade/example.php

-- I want to return "gatorade".

Any ideas?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top