TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-16-2008, 09:42 PM   #1 (permalink)
The Contributor
 
Ross's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
Ross is on a distinguished road
Default Coding Standards

We need to make a decision on this before any code is written - and we all want to get started.

Below is my natural way of coding - there will almost certainly be parts you disagree on and will want to change. Post what you would do differently. We will work on the code type that is most popular - simply so most of us aren't working differently than the way we would normally - unless it could be more efficient to use a different format (conditionals etc.).

PHP Code:
<?php

     
/**
      * Multi line comment/docblock
      * 5 spaces / tab
      */
     
     /**
      * @class MyClass
      * @final
      */
     
final class MyClass{
          private 
$config;
          
          
/**
           * Constructor
           * @param array Argument array
           */
          
public function __construct($args){
               if(
count($args) < 10 && !is_object($args)){
                    die(
'lolage');
               }
               
               (
is_array($args)) ? echo('foo') : echo('bar');
          }
     }

?>
(May expand on tomorrow, this was a quick one).

As for tabs/spaces any decent editor will convert tabs to spaces for you. I've recently started using NetBeans for Java, and then found a PHP plugin to use with it. This supports tabs to n spaces. Tabs display differently so I propose we use spaces as standard for indetation.
Ross is offline  
Reply With Quote
The Following User Says Thank You to Ross For This Useful Post:
codefreek (07-19-2008)
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:30 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design