Reputation: 154
Say I have this:
folder-one/folder-2/folder-3/myfile.php
How would I be able to find the name of "folder-2"?
I know that if I use basename(__DIR__)
I will get 'folder-3' but I really need to find folder-2 and folder-one?
Upvotes: 0
Views: 61
Reputation: 141927
If __DIR__
is 'folder-one/folder-2/folder-3', then you can just use:
$dir = basename( dirname( __DIR__ ) );
Upvotes: 2