public static function getPathsBase(&$a, &$b, $modify = false, $DS = DIRECTORY_SEPARATOR) {
        if ($modify) {
            $str1 = &$a;
            $str2 = &$b;
        } else {
            $str1 = $a;
            $str2 = $b;
        }

        $str1 = explode($DS, self::unify_slashes($str1, $DS));
        $str2 = explode($DS, self::unify_slashes($str2, $DS));
        $match = array();
        for ($i=0; $i < count($str1); $i++) { 
            if ($str1[$i] === $str2[$i]) {
                $match[] = $str1[$i];
            } else {
                break;
            }
        }
        $match = implode($DS, $match);
        $str1 = substr(implode($DS, $str1), strlen($match));
        $str2 = substr(implode($DS, $str2), strlen($match));

        return $match;
    }
public static function getPathsBase(&$a, &$b, $modify = false, $DS = DIRECTORY_SEPARATOR) {
        if ($modify) {
            $str1 = &$a;
            $str2 = &$b;
        } else {
            $str1 = $a;
            $str2 = $b;
        }

        $str1 = explode($DS, self::unify_slashes($str1, $DS));
        $str2 = explode($DS, self::unify_slashes($str2, $DS));
        $match = array();
        for ($i=0; $i < count($str1); $i++) { 
            if ($str1[$i] === $str2[$i]) {
                $match[] = $str1[$i];
            } else {
                break;
            }
        }
        $match = implode($DS, $match);
        $str1 = substr(implode($DS, $str1), strlen($match));
        $str2 = substr(implode($DS, $str2), strlen($match));

        return $match;
    }
public static function getPathsBase ( & $ a , & $ b , $ modify = false , $ DS = DIRECTORY_SEPARATOR ) { if ( $ modify ) { $ str1 = & $ a ; $ str2 = & $ b ; } else { $ str1 = $ a ; $ str2 = $ b ; } $ str1 = explode ( $ DS , self :: unify_slashes ( $ str1 , $ DS ) ) ; $ str2 = explode ( $ DS , self :: unify_slashes ( $ str2 , $ DS ) ) ; $ match = array ( ) ; for ( $ i = 0 ; $ i < count ( $ str1 ) ; $ i ++ ) { if ( $ str1 [ $ i ] === $ str2 [ $ i ] ) { $ match [ ] = $ str1 [ $ i ] ; } else { break ; } } $ match = implode ( $ DS , $ match ) ; $ str1 = substr ( implode ( $ DS , $ str1 ) , strlen ( $ match ) ) ; $ str2 = substr ( implode ( $ DS , $ str2 ) , strlen ( $ match ) ) ; return $ match ; }
Return the folder on with the both given paths split.

@param  string  $a      first path
@param  string  $b      second path
@param  boolean $modify set true to directly shorten the passed paths to be relative to the return values
@param  string  $DS     the directory separator that should be used.
@return string
Return the folder on with the both given paths split .