Re: Coding Standards
| From: | Martin Jansen | Date: | Tue, 29 Jun 2004 19:56:24 +0000 |
| Subject: | Re: Coding Standards | ||
| References: | 1 2 3 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-4548@lists.php.net to get a copy of this message | ||
On Tue Jun 22, 2004 at 09:5638PM +1000, Aidan Lister wrote:
> > > $foo = (bool)$foo;
> > > $foo = ( bool ) $foo;
> > > $foo = (bool) $foo;
> >
> > So, which format are you choosing? It seems to me the vast majority of
> > code already in the repository, and elsewhere, uses the first format, so
> > it seems best to make that the standard.
>
> Although I prefer the first, the third is more accepted and "proper". I
> suggest we go with that.
>
> > > define ('CAT_PACK_BASE', basename(__FILE__));
> > > require_once CAT_PACK_BASE . 'Driver/mysql.php';
> >
> > Yuck. Defining constants is expensive. Plus it obfuscates what's being
> > included.
>
> True, but it's faster and allows you to check if a file exists before
> including it.
Are you sure that it's faster? I don't really like the idea of using
dirname(__FILE__), because one is unable to e.g. use drivers in factory
methods that are located in "other" directories.
--
- Martin Martin Jansen
http://martinjansen.com/