Re[2]: [PHP] Code optimization: single vs. double quotes?
Hi, Tuesday, October 28, 2003, 9:26:13 AM, you wrote: CWP Curt Zirzow mailto:[EMAIL PROTECTED] CWP on Monday, October 27, 2003 3:16 PM said: 5. no newline after the tr. :) There are some broswer issues with tr and td's not being on the same line. CWP Ok I resisted sending this earlier but it appears it is now necessary. CWP ;) CWP Here is how I WOULD have written that line had it been in my own code. CWP (Minus some CSS that could be put in.) CWPecho table\n CWP. tr\n CWP. td class=\row_bright\$somevalue/td\n CWP. /tr\n CWP./table\n; I find the . operator to be very slow with strings :) (slow being relative of course) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
olinux mailto:[EMAIL PROTECTED] on Friday, October 24, 2003 9:41 PM said: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; uggh - apparently you've never had to redesign a site/application that uses this style. This is one table cell, but when you work this style through a big app, it's a huge pain (waste of time) to make any changes. Apparently. What do you recommend? c. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
[snip] echo td bgcolor=\$bgcolor2\nbsp;/td/tr; uggh - redesign recommend? [/snip] CSS! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
Jay Blanchard mailto:[EMAIL PROTECTED] on Monday, October 27, 2003 9:31 AM said: CSS! :) Oh that's what he meant? I thought he was talking about the quoting style used on that line. Chris. p.s. The last time I actually used bgcolor was probably almost a year ago. :) -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Tuesday, October 28, 2003, at 04:29 AM, Chris W. Parker wrote: olinux mailto:[EMAIL PROTECTED] on Friday, October 24, 2003 9:41 PM said: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; uggh - apparently you've never had to redesign a site/application that uses this style. This is one table cell, but when you work this style through a big app, it's a huge pain (waste of time) to make any changes. Apparently. What do you recommend? You have plenty of options... a b would be my preference: a) echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; b) echo td bgcolor='$bgcolor2'nbsp;/td/tr; c) echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; d) echo td bgcolor='.$bgcolor2.'nbsp;/td/tr; Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
Justin French mailto:[EMAIL PROTECTED] on Monday, October 27, 2003 2:12 PM said: a) echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; b) echo td bgcolor='$bgcolor2'nbsp;/td/tr; c) echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; d) echo td bgcolor='.$bgcolor2.'nbsp;/td/tr; Exactly what is the problem with: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; I don't see the problem. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
--- Justin French [EMAIL PROTECTED] wrote: a) echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; The curly braces are superfluous here, since you are using double quotes. I'm not sure if you like having them there, but I think that less syntax yields a simpler and cleaner appearance. However, I hate single quotes around HTML attributes, so I can't bring myself to use that format anyway. :-) Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
Chris Shiflett mailto:[EMAIL PROTECTED] on Monday, October 27, 2003 2:30 PM said: --- Justin French [EMAIL PROTECTED] wrote: a) echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; The curly braces are superfluous here, since you are using double quotes. I'm not sure if you like having them there, but I think that less syntax yields a simpler and cleaner appearance. However, I hate single quotes around HTML attributes, so I can't bring myself to use that format anyway. :-) +1 -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
--- Chris W. Parker [EMAIL PROTECTED] wrote: Exactly what is the problem with: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; I don't see the problem. I agree with you, actually. The only things I don't like are: 1. The use of the bgcolor attribute 2. The name of the variable :-) 3. The fact that your td is not tabbed in 4. The closing tr being on the same line But, everyone has different tastes. I tend to choose whichever format makes my HTML look perfect while requiring the least amount of syntax in PHP. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]): --- Chris W. Parker [EMAIL PROTECTED] wrote: Exactly what is the problem with: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; I don't see the problem. I agree with you, actually. The only things I don't like are: 1. The use of the bgcolor attribute 2. The name of the variable :-) 3. The fact that your td is not tabbed in 4. The closing tr being on the same line But, everyone has different tastes. I tend to choose whichever format makes my HTML look perfect while requiring the least amount of syntax in PHP. 5. no newline after the tr. :) There are some broswer issues with tr and td's not being on the same line. But I guess that shouldn't matter much cause tables shouldn't be used for layout design. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
It's said that you shouldn't use tables for layout, but does people accutually listen to that? And what instead? -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com ## Please, if you are using windows, you may be infected by Swen. Please go here to find out more: http://us.mcafee.com/virusInfo/default.asp?id=helpCenterhcName=swen http://securityresponse.symantec.com/avcenter/venc/data/[EMAIL PROTECTED] ## Curt Zirzow [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] * Thus wrote Chris Shiflett ([EMAIL PROTECTED]): --- Chris W. Parker [EMAIL PROTECTED] wrote: Exactly what is the problem with: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; I don't see the problem. I agree with you, actually. The only things I don't like are: 1. The use of the bgcolor attribute 2. The name of the variable :-) 3. The fact that your td is not tabbed in 4. The closing tr being on the same line But, everyone has different tastes. I tend to choose whichever format makes my HTML look perfect while requiring the least amount of syntax in PHP. 5. no newline after the tr. :) There are some broswer issues with tr and td's not being on the same line. But I guess that shouldn't matter much cause tables shouldn't be used for layout design. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
It's said that you shouldn't use tables for layout, but does people accutually listen to that? And what instead? This is veering off-topic, but: http://css-discuss.incutio.com/?page=CssLayouts - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
Curt Zirzow mailto:[EMAIL PROTECTED] on Monday, October 27, 2003 3:16 PM said: 5. no newline after the tr. :) There are some broswer issues with tr and td's not being on the same line. Ok I resisted sending this earlier but it appears it is now necessary. ;) Here is how I WOULD have written that line had it been in my own code. (Minus some CSS that could be put in.) echo table\n . tr\n . td class=\row_bright\$somevalue/td\n . /tr\n ./table\n; But I guess that shouldn't matter much cause tables shouldn't be used for layout design. In an effort to avoid confusing people that don't know any better layout design means everything except forms and data. Chris. p.s. And yes Curt you touched on why I put my td/td's all on one line. Some browsers (I know IE does) like to add whitespace if the td and /td are not all on the same line. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
--- DvDmanDT [EMAIL PROTECTED] wrote: It's said that you shouldn't use tables for layout, but does people accutually listen to that? And what instead? You can use stylesheets. These work well with PHP. Well, that's my attempt at getting this thread back on topic. :-) Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
--- Chris W. Parker [EMAIL PROTECTED] wrote: p.s. And yes Curt you touched on why I put my td/td's all on one line. Some browsers (I know IE does) like to add whitespace if the td and /td are not all on the same line. Which is why I didn't complain about that. :-) You had your closing tr on the same line. That was not related to spacing concerns, I assume. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Tuesday, October 28, 2003, at 09:23 AM, Chris W. Parker wrote: Exactly what is the problem with: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; it's purely personal -- i don't enjoy writing, re-writing, debugging or modifying code with 100's of escaped double quotes everywhere when they really aren't needed. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Tuesday, October 28, 2003, at 09:29 AM, Chris Shiflett wrote: --- Justin French [EMAIL PROTECTED] wrote: a) echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; The curly braces are superfluous here, since you are using double quotes. I'm not sure if you like having them there, but I think that less syntax yields a simpler and cleaner appearance. Yes, they are superfluous in this example, but not because we're in double quotes. You can ONLY use complex strings inside double quotes, AFAIK: ? $str = blah; echo {$str}br /;// echos blahbr / echo '{$str}br /'; // echos {$str}br / ? As I'm sure you're aware, the use of the {braces} is to allow complex combinations of variables, like found in the manual http://www.php.net/types.string In the above example, they are indeed not needed, but I've gotten into the habbit of using them on all strings for a few reasons; - the fact that there can be no confusion (either human or PHP) over what I mean - PHP will be non-greedy when looking for the valid variable name - since i'm now in the habbit, I never have to debug examples where it IS needed :) However, I hate single quotes around HTML attributes, so I can't bring myself to use that format anyway. :-) Well, that's where we come down to personal opinion... personally, seeing \ 100's of times in a script doesn't turn me on at all :) Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
I am a recent fan of the single-quotes. I used to use double only but when some gurus told me the disadvantages I converted my entire project over to single quotes. Single quotes are ideal because as far coding goes it greatly decreases the time of development when you don't have to worry about dropping in the escape character on your HTML values, etc. Granted, single quotes can be a nuisance in some instances (like when you need a new line character) but of course there is a way around. I simply define a constant and call that at the end of every line in order to substitute for the new line character. Horizontal Tab - define(T, chr(9)); New Line - define(NL, chr(10)); Cheers, Nathan - Original Message - From: Robert Cummings To: Shawn McKenzie Cc: PHP-General Sent: Thursday, October 23, 2003 10:30 PM Subject: Re: [PHP] Code optimization: single vs. double quotes? On Thu, 2003-10-23 at 20:43, Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Better is a very subjective question; however, style 1 will run faster since it won't look for variable interpolation. Personally I always use style 1 unless I specifically need variable interpolation or one of the special characters such as a newline. Also when doing HTML the double quotes fit nicely in the the single quote paradigm. On the other hand when I do SQL queries, I often allow interpolation just because it is more readable and because I usually use single quotes to wrap strings in my queries. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Friday, October 24, 2003, at 10:43 AM, Shawn McKenzie wrote: For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Better is a very loose term, but I've adopted a coding style which uses single quotes on all lines which don't require special characters (\n, \t, etc) or variables. At the same time, I dropped double quotes within my HTML where possible, realising that most of my echo's had double quotes, so I was escaping a lot of quotes. I also adapted wrapping all variables in {parenthesis} so that PHP has no chance of being confused On all but the most heavily visited sites, it's my humble opinion that you should take the approach of what's fast for you to code, read, maintain and re-develop, rather than what might get you a .0001 % performance gain -- this is most likely due to the nature of the sites I develop -- but this seems to be the general consensus I've read over many years and from many sources. No special chars or vars: echo 'td bgcolor=\'#ff\'nbsp;/td/tr'; For cases with vars and special chars, I think these look terrible: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Whereas this is clear and easy to work with: echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; You mileage will vary, but unless you're working on a hugely successful site (the kind that needs a dedicated server), take your personal preferences, and long-term readability and maintainability into account when deciding what suits you. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
on 10/24/03 0:47, Nathan Taylor at [EMAIL PROTECTED] wrote: I am a recent fan of the single-quotes. I used to use double only but when some gurus told me the disadvantages I converted my entire project over to single quotes. Single quotes are ideal because as far coding goes it greatly decreases the time of development when you don't have to worry about dropping in the escape character on your HTML values, etc. Granted, single quotes can be a nuisance in some instances (like when you need a new line character) but of course there is a way around. I simply define a constant and call that at the end of every line in order to substitute for the new line character. Horizontal Tab - define(T, chr(9)); New Line - define(NL, chr(10)); Cheers, Nathan - Original Message - From: Robert Cummings To: Shawn McKenzie Cc: PHP-General Sent: Thursday, October 23, 2003 10:30 PM Subject: Re: [PHP] Code optimization: single vs. double quotes? On Thu, 2003-10-23 at 20:43, Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Better is a very subjective question; however, style 1 will run faster since it won't look for variable interpolation. Personally I always use style 1 unless I specifically need variable interpolation or one of the special characters such as a newline. Also when doing HTML the double quotes fit nicely in the the single quote paradigm. On the other hand when I do SQL queries, I often allow interpolation just because it is more readable and because I usually use single quotes to wrap strings in my queries. Now what is wrong with doing this? echo 'td bgcolor=whitenbsp;/td'.\r\n; That way you can still use your single quotes and still being able to use the \r\n.. that does work doesn¹t it? Im pretty sure I have used it before.. Anyways I guess the point is that you are not forced to use double quotes for the full echo just so you can use the special newline characters.. Rick Freedom and immorality can not co-exist because freedom requires personal responsibility. - Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
That style is also the one I use. It works well, it is clean, and it is straightforward. Joachim Richard Baskett wrote: on 10/24/03 0:47, Nathan Taylor at [EMAIL PROTECTED] wrote: I am a recent fan of the single-quotes. I used to use double only but when some gurus told me the disadvantages I converted my entire project over to single quotes. Single quotes are ideal because as far coding goes it greatly decreases the time of development when you don't have to worry about dropping in the escape character on your HTML values, etc. Granted, single quotes can be a nuisance in some instances (like when you need a new line character) but of course there is a way around. I simply define a constant and call that at the end of every line in order to substitute for the new line character. Horizontal Tab - define(T, chr(9)); New Line - define(NL, chr(10)); Cheers, Nathan - Original Message - From: Robert Cummings To: Shawn McKenzie Cc: PHP-General Sent: Thursday, October 23, 2003 10:30 PM Subject: Re: [PHP] Code optimization: single vs. double quotes? On Thu, 2003-10-23 at 20:43, Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Better is a very subjective question; however, style 1 will run faster since it won't look for variable interpolation. Personally I always use style 1 unless I specifically need variable interpolation or one of the special characters such as a newline. Also when doing HTML the double quotes fit nicely in the the single quote paradigm. On the other hand when I do SQL queries, I often allow interpolation just because it is more readable and because I usually use single quotes to wrap strings in my queries. Now what is wrong with doing this? echo 'td bgcolor=whitenbsp;/td'.\r\n; That way you can still use your single quotes and still being able to use the \r\n.. that does work doesn¹t it? Im pretty sure I have used it before.. Anyways I guess the point is that you are not forced to use double quotes for the full echo just so you can use the special newline characters.. Rick Freedom and immorality can not co-exist because freedom requires personal responsibility. - Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
No special chars or vars: echo 'td bgcolor=\'#ff\'nbsp;/td/tr'; For cases with vars and special chars, I think these look terrible: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; I'm a fan of this style - works great with syntax highlighting in homesite. olinux echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Whereas this is clear and easy to work with: echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Fri, 2003-10-24 at 03:57, Justin French wrote: On Friday, October 24, 2003, at 10:43 AM, Shawn McKenzie wrote: [--CLIPPETY CLIP CLIP--] Whereas this is clear and easy to work with: echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; Unless your $bgcolor2 variable has double quotes in it, then the above is poor HTML style. I don't think omission of double quotes has been considered valid HTML since version 3 (admittedly though, as long as they let it render, people will use it :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
Justin French mailto:[EMAIL PROTECTED] on Friday, October 24, 2003 12:57 AM said: I also adapted wrapping all variables in {parenthesis} so that PHP has no chance of being confused heh... actually those are {curly braces} and these are (parenthesis). No special chars or vars: echo 'td bgcolor=\'#ff\'nbsp;/td/tr'; Even better (and valid HTML too!): echo 'td bgcolor=#ffnbsp;/td/tr'; I've always been a big fan of: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; But this has been an interesting topic so I might just start changing my style. Chris. p.s. If you're wondering how heredoc fits into all of this, it's really slow. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
Robert Cummings wrote: echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; Unless your $bgcolor2 variable has double quotes in it, then the above is poor HTML style. I don't think omission of double quotes has been considered valid HTML since version 3 (admittedly though, as long as they let it render, people will use it :) Cheers, Rob. Single quotes are valid in html, though not in xhtml. Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Fri, 2003-10-24 at 12:03, Marek Kilimajer wrote: Robert Cummings wrote: echo td bgcolor='{$bgcolor2}'nbsp;/td/tr; Unless your $bgcolor2 variable has double quotes in it, then the above is poor HTML style. I don't think omission of double quotes has been considered valid HTML since version 3 (admittedly though, as long as they let it render, people will use it :) Cheers, Rob. Single quotes are valid in html, though not in xhtml. Whoops my bad, for some reason I saw those single quotes as string delimiters, which really makes no sense on my part at all. I'm claiming the just woke up excuse :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code optimization: single vs. double quotes?
--- Chris W. Parker [EMAIL PROTECTED] wrote: I've always been a big fan of: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; uggh - apparently you've never had to redesign a site/application that uses this style. This is one table cell, but when you work this style through a big app, it's a huge pain (waste of time) to make any changes. olinux __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Code optimization: single vs. double quotes?
I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
I remember reading something very very similar from one of the main php developers.. However, for the life of me, I can't remember where it was exactly... Jordan S. Jones Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code optimization: single vs. double quotes?
On Thu, 2003-10-23 at 20:43, Shawn McKenzie wrote: I came across this post and was hoping to get a gurus opinion on the validity. TIA -Shawn I remember reading somewhere re: PHP coding that it is a better coding practice to use single quotes as much as possible vs. using double quotes in scripts. When using double quotes, you are forcing PHP to look for variables within them, even though there may not be any, thus slowing execution time... For example it is better to code: Code: echo 'td bgcolor='.$bgcolor2.'nbsp;/td/tr'; vs. Code: echo td bgcolor=\$bgcolor2\nbsp;/td/tr; Better is a very subjective question; however, style 1 will run faster since it won't look for variable interpolation. Personally I always use style 1 unless I specifically need variable interpolation or one of the special characters such as a newline. Also when doing HTML the double quotes fit nicely in the the single quote paradigm. On the other hand when I do SQL queries, I often allow interpolation just because it is more readable and because I usually use single quotes to wrap strings in my queries. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php