public static function joinPath( $base, $path ) {
		if ( substr( $path, 0, 1 ) === '/' ) {
			// $path is absolute.
			return $path;
		}

		if ( substr( $base, 0, 1 ) !== '/' ) {
			// $base is relative.
			return false;
		}

		$pathParts = self::splitPath( $path );
		$resultParts = self::splitPath( $base );

		while ( ( $part = array_shift( $pathParts ) ) !== null ) {
			switch ( $part ) {
			case '.':
				break;
			case '..':
				if ( count( $resultParts ) > 1 ) {
					array_pop( $resultParts );
				}
				break;
			default:
				$resultParts[] = $part;
				break;
			}
		}

		return implode( '/', $resultParts );
	}
public static function joinPath( $base, $path ) {
		if ( substr( $path, 0, 1 ) === '/' ) {
			// $path is absolute.
			return $path;
		}

		if ( substr( $base, 0, 1 ) !== '/' ) {
			// $base is relative.
			return false;
		}

		$pathParts = self::splitPath( $path );
		$resultParts = self::splitPath( $base );

		while ( ( $part = array_shift( $pathParts ) ) !== null ) {
			switch ( $part ) {
			case '.':
				break;
			case '..':
				if ( count( $resultParts ) > 1 ) {
					array_pop( $resultParts );
				}
				break;
			default:
				$resultParts[] = $part;
				break;
			}
		}

		return implode( '/', $resultParts );
	}
public static function joinPath ( $ base , $ path ) { if ( substr ( $ path , 0 , 1 ) === '/' ) { // $path is absolute. return $ path ; } if ( substr ( $ base , 0 , 1 ) !== '/' ) { // $base is relative. return false ; } $ pathParts = self :: splitPath ( $ path ) ; $ resultParts = self :: splitPath ( $ base ) ; while ( ( $ part = array_shift ( $ pathParts ) ) !== null ) { switch ( $ part ) { case '.' : break ; case '..' : if ( count ( $ resultParts ) > 1 ) { array_pop ( $ resultParts ) ; } break ; default : $ resultParts [ ] = $ part ; break ; } } return implode ( '/' , $ resultParts ) ; }
Join path components.

@param string $base Base path.
@param string $path File path to join to base path.
@return string
Join path components .