RE: [PHP] Coding Conventions

From: Date: Fri, 03 Nov 2000 23:21:46 +0000
Subject: RE: [PHP] Coding Conventions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23658@lists.php.net to get a copy of this message
On Fri, 3 Nov 2000 16:59:27 -0500, Ferris, Joseph (joseph.ferris@cdicorp.com) wrote: >It is really a matter of balance... Visibly, both are acceptable. >The >style that I would choose would depend on the amount of data and >possessing >that is going on. I think the difference in speed is so minor it's not really worth considering. >If there are large areas of fairly static text, I would use example >two. >But, if there were more equations and a tendency for the data to be >more >"dynamic", I would choose the first example. I think it's always a good idea to go with number 2, I also try to keep php in the top of the file (or include files) and use the smallest possible amount of php when switching between php and html. The best reason for this is when I'm working with a designer who uses dreamweaver. It's also easier for me to read. for example: <html><head><title>hello world</title><head> <body> <?if() {?> do some stuff <?} else {?> do some other stuff <?}?> </body> </html> dreamweaver will show him both blocks, and he can edit them both. with 1) he won't be able to edit anything. It would be nice if the Php team would publish style guidelines like the java guys do. - Mark >Hope that helps, > >Joseph >joseph.ferris@cdicorp.com > >-----Original Message----- >From: Kevin Queen [mailto:kqueen@anydevice.com] >Sent: Friday, November 03, 2000 12:18 PM >To: php-general@lists.php.net >Subject: [PHP] Coding Conventions > > >List, >I have a general knowledge question, is it best to code with one set >of php >tags or many, examples follow: > >Example 1: >==================== ><?php > echo('<html><head><title>hello >world</title></head><body><p>'); > >if($a==$b){ > do some stuff > } >echo('about to do more stuff'); >if($c==$d){ > do more stuff > } > >echo('</body></html>'); >?> > >Example 2: >=================== ><html><head><title>hello world</title><head> ><body> > ><?php > if($a==$b){ > do some stuff > } >?> >About to do more stuff ><?php > if($c==$d){ > do more stuff > } >?> ></body> ></html> > > >Is there a better of preferred way of coding, is one faster than the >other? >This is just a curiosity question, thank you for your input. > >TIA, >Kevin Queen > > >-- >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 > > >_____________________________________________________________________ >This message has been checked for all known viruses by UUNET >delivered >through the MessageLabs Virus Control Centre. For further >information visit >http://www.uk.uu.net/products/security/virus/ > >-- >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 (#23658) next »