Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14833

Re: mysql_connect statement not connecting to database

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: mysql_connect statement not connecting to database
Date 2015-01-17 15:48 +0100
Organization PointedEars Software (PES)
Message-ID <1879834.QDGmRacGsM@PointedEars.de> (permalink)
References <66710953-7d91-407e-8589-b919c0adba6a@googlegroups.com> <5602796.CH6WsXFhKx@PointedEars.de> <87k30nzv68.fsf@ahungry.com>

Show all headers | View raw


Matthew Carter wrote:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> It is also not a good idea to let the opening parenthesis of a function
>> call be preceded by whitespace.  This style should be reserved for 
>> control statements like “if”.
>> […]
> 
> GNU style indentation does require a space before the parenthesis (even
> for a function call), although I'd imagine there are few GNU based
> PHP projects.

My experience (15 years with PHP now) and recent research indicates that 
GNU Style is unheard of in the greater PHP developer community.

PHP coding styles include, in no particular order, and not exhaustive:

- PEAR and PEAR2 Coding Standards
  <http://pear.php.net/manual/en/coding-standards.php>

- PHP Standard Recommendations PSR-1, PSR-2, and PSR-4 (deprecates PSR-0)
  <https://github.com/php-fig/fig-standards/tree/master/accepted>

- Symfony Coding Standards (“follows the standards defined in the PSR-0, 
  PSR-1 and PSR-2 documents”)
  <http://symfony.com/doc/current/contributing/code/standards.html>

- Drupal Coding Standards (“loosely based on the PEAR Coding Standards”)
  <https://www.drupal.org/coding-standards>

- WordPress PHP Coding Standards (“similar to Pear standards in many ways,
  but differ in some key respects”)
  <https://make.wordpress.org/core/handbook/coding-standards/php/>

- Zend Framework Coding Standard for PHP:
  currently <http://framework.zend.com/manual/1.12/en/coding-standard.html>
  (no Coding Standard has been published for ZF2 yet, so we can assume that
  also applies for ZF2 code)

- Moodle Coding Style
  <https://docs.moodle.org/dev/Coding_style>

(all retrieved as of the date of this posting)

> Looking at how its completely inconsistent though, I don't think this
> was GNU style indentation (my personal favorite actually).

I could live with GNU Style¹ if it would not make it so hard to tell 
function/method calls apart.  (I prefer Allman style [ibd.] except for 
expressions, and I have started to insert the space before parameter lists 
in declarations, to tell them apart from calls.)

Please trim your quotes to the relevant minimum.  In particular, full quotes 
are not acceptable.  <https://www.netmeister.org/news/learn2quote.html>
 
_________
¹  <https://en.wikipedia.org/wiki/Indent_style#GNU_style>

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

mysql_connect statement not connecting to database mcghepa@gmail.com - 2015-01-15 08:21 -0800
  Re: mysql_connect statement not connecting to database Matthew Carter <m@ahungry.com> - 2015-01-15 11:49 -0500
  Re: mysql_connect statement not connecting to database Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-15 18:01 +0100
    Re: mysql_connect statement not connecting to database Matthew Carter <m@ahungry.com> - 2015-01-15 14:43 -0500
      Re: mysql_connect statement not connecting to database Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-17 15:48 +0100
        Indent style (was: mysql_connect statement not connecting to database) "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-17 18:13 +0100
          Re: Indent style Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-17 19:08 +0100
            Re: Indent style "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-22 14:22 +0100
    Re: mysql_connect statement not connecting to database richard <noreply@example.com> - 2015-01-16 00:10 -0500
      Re: mysql_connect statement not connecting to database Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-16 10:03 +0000

csiph-web