Skip to content

Instantly share code, notes, and snippets.

@yano3nora
Last active November 22, 2018 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yano3nora/69ac266a022865a58457b2233139b1a7 to your computer and use it in GitHub Desktop.
Save yano3nora/69ac266a022865a58457b2233139b1a7 to your computer and use it in GitHub Desktop.
[php: getParentDirName] #php
<?php
// get parent dir name
$dirs = explode('/', __DIR__);
$parentDir = array_pop($dirs);
@mesbahulalam
Copy link

mesbahulalam commented Nov 22, 2018

I use it on windows machine and on linux simultaneously so,
$dirs = explode(DIRECTORY_SEPARATOR, __DIR__);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment