Re: Which is better coding style...

From: Date: Fri, 20 Apr 2001 00:58:11 +0000
Subject: Re: Which is better coding style...
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-49472@lists.php.net to get a copy of this message
IMHO, I like the second. Too much real-code time to break old habits. I don't like returning mid-method. I -really- don't like it. =) As for the placement of braces...I like /* return type */ function PhpFunction(params) { } I'm usually not too worried about whitespace, either, so I'm all about if (true) { do_something(); } else { do_something_else(); } Whitespace, IMHO, LOOKS less efficient but has the advantage of being easier to follow/read/debug. Also more space to put in debugging snippets in lieu of having a real interactive debugger with a stack trace. And I've got LOTS of diskspace.... =) function foo($varArray){foreach($varArray as $element){echo "this is 'tighter'\n";echo "but is it really worth it?\";} if (sizeof($varArray) == 1){echo "1 element";}else{echo sizeof($varArray);} echo "Know what I mean, Vern?";} -Szii ----- Original Message ----- From: Chris Lee <lee@mediawaveonline.com> To: <php-general@lists.php.net> Sent: Thursday, April 19, 2001 3:51 PM Subject: Re: [PHP] Which is better coding style... > I would like to see an editor with a built in code beutifier and un-beutifier. I like the > > if (true) > { > > } else > { > > } > > method, but pear standards are > > if (true) { > > } else { > > } > > it would be nice to see ultra edit convert it to the first format for me and save it as the second for pear. > > > -- > > Chris Lee > lee@mediawaveonline.com > > > > "Philip Olson" <philip@cornado.com> wrote in message news:Pine.BSF.4.10.10104192119590.43248-100000@localhost... > > coding style? here's what pear has to say : > > http://www.php.net/manual/en/pear.standards.php > http://www.php.net/manual/en/pear.standards.control.php > > [ example ] > > switch (condition) { > case 1: > action1; > break; > > case 2: > action2; > break; > > default: > defaultaction; > break; > > } > > [ /example ] > > > variables can be very useful. > return is cool too. > > :) > > regards, > philip > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49472) next »