src/xPDO/xPDO.php
public static function parseDSN($string) {
        $result= array ();
        $pos= strpos($string, ':');
        $result['dbtype']= strtolower(substr($string, 0, $pos));
        $parameters= explode(';', substr($string, ($pos +1)));
        for ($a= 0, $b= count($parameters); $a < $b; $a++) {
            $tmp= explode('=', $parameters[$a]);
            if (count($tmp) == 2) {
                $result[strtolower(trim($tmp[0]))]= trim($tmp[1]);
            } else {
                $result['dbname']= trim($parameters[$a]);
            }
        }
        if (!isset($result['dbname']) && isset($result['database'])) {
            $result['dbname'] = $result['database'];
        }
        if (!isset($result['host']) && isset($result['server'])) {
            $result['host'] = $result['server'];
        }
        return $result;
    }
public static function parseDSN($string) {
        $result= array ();
        $pos= strpos($string, ':');
        $result['dbtype']= strtolower(substr($string, 0, $pos));
        $parameters= explode(';', substr($string, ($pos +1)));
        for ($a= 0, $b= count($parameters); $a < $b; $a++) {
            $tmp= explode('=', $parameters[$a]);
            if (count($tmp) == 2) {
                $result[strtolower(trim($tmp[0]))]= trim($tmp[1]);
            } else {
                $result['dbname']= trim($parameters[$a]);
            }
        }
        if (!isset($result['dbname']) && isset($result['database'])) {
            $result['dbname'] = $result['database'];
        }
        if (!isset($result['host']) && isset($result['server'])) {
            $result['host'] = $result['server'];
        }
        return $result;
    }
public static function parseDSN ( $ string ) { $ result = array ( ) ; $ pos = strpos ( $ string , ':' ) ; $ result [ 'dbtype' ] = strtolower ( substr ( $ string , 0 , $ pos ) ) ; $ parameters = explode ( ';' , substr ( $ string , ( $ pos + 1 ) ) ) ; for ( $ a = 0 , $ b = count ( $ parameters ) ; $ a < $ b ; $ a ++ ) { $ tmp = explode ( '=' , $ parameters [ $ a ] ) ; if ( count ( $ tmp ) == 2 ) { $ result [ strtolower ( trim ( $ tmp [ 0 ] ) ) ] = trim ( $ tmp [ 1 ] ) ; } else { $ result [ 'dbname' ] = trim ( $ parameters [ $ a ] ) ; } } if ( ! isset ( $ result [ 'dbname' ] ) && isset ( $ result [ 'database' ] ) ) { $ result [ 'dbname' ] = $ result [ 'database' ] ; } if ( ! isset ( $ result [ 'host' ] ) && isset ( $ result [ 'server' ] ) ) { $ result [ 'host' ] = $ result [ 'server' ] ; } return $ result ; }
Parses a DSN and returns an array of the connection details.

@static
@param string $string The DSN to parse.
@return array An array of connection details from the DSN.
@todo Have this method handle all methods of DSN specification as handled
by latest native PDO implementation.
Parses a DSN and returns an array of the connection details .