How to extract a specific folder's name in PHP? -


say have this:

folder-one/folder-2/folder-3/myfile.php 

how able find name of "folder-2"? know if use basename(__dir__) 'folder-3' need find folder-2 , folder-one?

use dirname basename.

if __dir__ 'folder-one/folder-2/folder-3', can use:

$dir = basename( dirname( __dir__ ) ); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -