public static function getParentPathFromPath($path) { $array = StringUtility::getExplodedStringArray('/', $path); $count = count($array); if ($count == 1) { return "/"; } else { if ($count > 1) { return implode('/', array_slice($array, 0, count($array) - 1)); } } return ""; // empty string }