Get parent directory, with a twist

Hi

I’m trying to run a function within the index.php directory that will return “directory2” as a variable/string…

http://www.website.com/directory1/directory2/directory3/index.php

I’ve tried using: dirname(dirname(FILE));

However, the function to return that parent directory is imported from an entirely separate php file of it’s own (quickfunctions.php). The dirname command only returns the parent directory from the php file that holds the function. I need it to return the parent directory of the index.php.

And ideas?