RE: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /pear DB.php /pear/DB common.phpmysql.php From: Chris Newbill (cnewbill <email protected>)
Date: 12/04/00

If you read the horde coding standards the snippet in question would read
(no tabs, 4 spaces and only the function definition is "one true brace")

function connect(&$dsn, $persistent = false)
{
    if (is_array($dsn)) {
        $dsninfo = &$dsn;
    } else {
        $dsninfo = DB::parseDSN($dsn);
    }
    if (!$dsninfo || !$dsninfo['phptype']) {
        return $this->raiseError();
    }
}

I for one find this very readable.

There is really no point to continue bickering about it, unless that
bickering is the process of drafting the standards.

Chris Newbill

-----Original Message-----
From: Sebastian Bergmann [mailto:sb <email protected>]

  Agreed, but are you really telling me that

        function connect(&$dsn, $persistent = false) {
                if (is_array($dsn)) {
                        $dsninfo = &$dsn;
                } else {
                        $dsninfo = DB::parseDSN($dsn);
                }
                if (!$dsninfo || !$dsninfo['phptype']) {
                        return $this->raiseError();
                }

  is more readable as

    function connect( &$dsn, $persistent = false )
    {
      if( is_array( $dsn ) )
      {
        $dsninfo = &$dsn;
      }

      else
      {
        $dsninfo = DB::parseDSN( $dsn );
      }

      if( !$dsninfo || !$dsninfo[ 'phptype' ] )
      {
        return $this->raiseError();
      }

  ?

--
  <? print implode( "", array_reverse( preg_split( "//", "dlrow laer "   .
  "eht ot emoclew" ) ) ); /* visit http://www.sebastian-bergmann.de/ */ ?>

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>