Skip to content

Instantly share code, notes, and snippets.

@cxfksword
Created March 20, 2014 10:07
Show Gist options
  • Save cxfksword/9660746 to your computer and use it in GitHub Desktop.
Save cxfksword/9660746 to your computer and use it in GitHub Desktop.
get user home path in php cli
function getUserHomePath() {
if (isset($_SERVER['HOME'])) {
return $_SERVER['HOME'];
}
if (PHP_OS == 'WINNT') {
return getenv('USERPROFILE');
} else {
return getenv('HOME');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment