I'm trying to get php to return the name of a directory like this:
http://www.foobar.com/example.php where example.php returns the name of the current directory as "" or "/" and
http://www.foobar.com/example_folder/example.php where php reutrns the name of the current directory as "example_folder" or "/example
_folder"

I found that getcwd() returns the file path, but that's not what I'm looking for

Try parse_url.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.