QuickBooks/Utilities.php
static public function parseDSN($dsn, $defaults = array(), $part = null)
	{
		// Some DSN strings look like this:		filesystem:///path/to/file
		//	parse_url() will not parse this *unless* we provide some sort of hostname (in this case, null)
		$dsn = str_replace(':///', '://null/', $dsn);
			
		$defaults = array_merge(array(
			'scheme' => '', 
			'host' => '', 
			'port' => 0, 
			'user' => '', 
			'pass' => '',
			'path' => '', 
			'query' => '',
			'fragment' => '',   
			), $defaults);
			
		$parse = array_merge($defaults, parse_url($dsn));
		
		$parse['user'] = urldecode($parse['user']);
		$parse['pass'] = urldecode($parse['pass']);
		
		if (is_null($part))
		{
			return $parse;
		}
		else if (isset($parse[$part]))
		{
			return $parse[$part];
		}
			
		return null;
	}
static public function parseDSN($dsn, $defaults = array(), $part = null)
	{
		// Some DSN strings look like this:		filesystem:///path/to/file
		//	parse_url() will not parse this *unless* we provide some sort of hostname (in this case, null)
		$dsn = str_replace(':///', '://null/', $dsn);
			
		$defaults = array_merge(array(
			'scheme' => '', 
			'host' => '', 
			'port' => 0, 
			'user' => '', 
			'pass' => '',
			'path' => '', 
			'query' => '',
			'fragment' => '',   
			), $defaults);
			
		$parse = array_merge($defaults, parse_url($dsn));
		
		$parse['user'] = urldecode($parse['user']);
		$parse['pass'] = urldecode($parse['pass']);
		
		if (is_null($part))
		{
			return $parse;
		}
		else if (isset($parse[$part]))
		{
			return $parse[$part];
		}
			
		return null;
	}
Parse a DSN style connection string

@param string $dsn		The DSN connection string
@param string $part		If you want just a specific part of the string, choose which part here: scheme, host, port, user, pass, query, fragment
@return mixed 			An array or a string, depending on if you wanted the whole thing parsed or just a piece of it