hope this function helps someone like me
function getPath($path) {
if(substr($path, -1, 1) == '/') {
return $path;
}
else {
$pathArr = explode('/', $path);
$total = count($pathArr);
$end = $pathArr[$total - 1];
if(substr_count($end, '.') > 0) {
array_pop($pathArr);
}
$finalPath = implode('/', $pathArr);
return $finalPath;
}
}
?>
No comments:
Post a Comment