Re: [PHP] General Coding Question
And what about the third option using single quotes on the outside i.e. print 'INPUT TYPE=TEXT VALUE='. $hash[var2] .'.. or even better print ' INPUT TYPE=TEXT VALUE='.$hash[var2].' SIZE= .. This should be better than an outer double quote since it stops any php parsing, so it's a bit faster and you don't have to worry if you have any dollar signs in the HTML. It does mean that you can't just embed the variables but then that doesn't work for array variables anyway yet, so it's no great loss. I must say I'm tempted by being able to write ? INPUT TYPE=TEXT SIZE=? if ($length20){print '40';} else {print '20';}? VALUE= etc.. rather than my normal style which would be : print ' INPUT TYPE=TEXT SIZE='; if ($length20) { print '40'; } else { print '20'; } print ' VALUE= etc.. I'd be very interested to hear other's views on what they find easiest. After all, style is mostly about making it easy for other people (especially the inexperienced) to maintain our code, not to suit our ideas of elegance. My own gut feeling is that consistency is probably the most important thing, i.e. pick any of the styles and then stick to it. What do you think? George Whiffen Chris Lee wrote: im here to start a flamewar. dont use then. why not use ' ? echo input type=\text\ name=\name\ value=\$name\ echo input type='text' name='name' value='$name' I like the second. it is proper html check it with w3.org. -- Chris Lee [EMAIL PROTECTED] scott [gts] [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on pages with mostly HTML code, the second style is much prefereable, but on pages with mostly PHP code, the first style is usually OK. overall, i tend towards the second, becuase it's a pain in the ass to esape all the double-quotes in my HTML, my echo statements usulaly end up looking like thi (which, to me, is terrible form) echo INPUT TYPE=\TEXT\ VALUE=\. $hash['var'] .\.. so i usually use this format, which to my eyes is much prettier :) ? INPUT TYPE=TEXT VALUE=?= $hash['var'] ? ? -Original Message- From: James Stevens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: [PHP] General Coding Question Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] General Coding Question
You don't use a lot of javascript, do you? Start your JS with \ and end it with \ inside PHP code. No biggie. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] General Coding Question
this whole bench thing really needs someone to sit down and go i bet i could write some code to see in less time then it would take to post ? dont get mad, people are allways posting this. is this aster then that ? write some code and see. its very hardware/os dependant. your system may be very diff then someone else. more likley then not. Agreed - many people in this group seem to ask does this work without actually trying it to see if it'll work... Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] General Coding Question
I dont think thats XHTML complient... Correct me if im wrong? -Original Message- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: 20 June 2001 23:50 To: [EMAIL PROTECTED] Subject: Re: [PHP] General Coding Question im here to start a flamewar. dont use then. why not use ' ? echo input type=\text\ name=\name\ value=\$name\ echo input type='text' name='name' value='$name' I like the second. it is proper html check it with w3.org. -- Chris Lee [EMAIL PROTECTED] scott [gts] [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on pages with mostly HTML code, the second style is much prefereable, but on pages with mostly PHP code, the first style is usually OK. overall, i tend towards the second, becuase it's a pain in the ass to esape all the double-quotes in my HTML, my echo statements usulaly end up looking like thi (which, to me, is terrible form) echo INPUT TYPE=\TEXT\ VALUE=\. $hash['var'] .\.. so i usually use this format, which to my eyes is much prettier :) ? INPUT TYPE=TEXT VALUE=?= $hash['var'] ? ? -Original Message- From: James Stevens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: [PHP] General Coding Question Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] General Coding Question
On Thursday 21 June 2001 09:31, Ray Hilton wrote: XML allows both single and double quotes for attributes, and XHTML is defined as XML DTD, so it allows it too. I dont think thats XHTML complient... Correct me if im wrong? -Original Message- im here to start a flamewar. dont use then. why not use ' ? echo input type=\text\ name=\name\ value=\$name\ echo input type='text' name='name' value='$name' I like the second. it is proper html check it with w3.org. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Never doubt that a small group of thoughtful, committed people can change the world... Indeed, it's the only thing that ever has. - Margaret Mead -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] General Coding Question
I posted the exact same question a while ago, because i know that ASP does slow down when you jump in and out of the asp dll. I tried benchmarking it, and asked my geekiest of geek friends. All results thus far point to the fact that both work just as well. and imho, the alternate syntax is a lot easier to read when switching between large blocks of html. q. -Original Message- From: James Stevens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 10:23 AM To: [EMAIL PROTECTED] Subject: [PHP] General Coding Question Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] General Coding Question
this whole bench thing really needs someone to sit down and go i bet i could write some code to see in less time then it would take to post ? dont get mad, people are allways posting this. is this aster then that ? write some code and see. its very hardware/os dependant. your system may be very diff then someone else. more likley then not. ?php function debug_time() { $debug_time = microtime(); $debug_time = str_replace('.', '', $debug_time); $debug_time = explode(' ', $debug_time); $debug_time = $debug_time[1] . $debug_time[0]; return($debug_time); } class debug { function debug() { $this-start = debug_time(); } function reset() { $all_vars = get_object_vars($this); foreach($all_vars as $pos = $val) if ($pos != 'error') unset($this-$pos); } function time($text = '') { $this-break = debug_time(); $time = ($this-break - $this-start) / 10; error_log(number_format($time, 4) . : $text \n, 3, '/var/log/php_err.log'); $this-start = $this-break; } } $debug = new debug; $debug-time('a'); for($c = 0; $c 10; $c++) echo test; $debug-time('b'); for($c = 0; $c 10; $c++) ?test?php $debug-time('a'); ? 0.0002 : a 2.0003 : b 1.9478 : a therefore on *my* system it is very very slightly faster to exit out of php and echo. i find it ugly. imho. -- Chris Lee [EMAIL PROTECTED] James Stevens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] General Coding Question
on pages with mostly HTML code, the second style is much prefereable, but on pages with mostly PHP code, the first style is usually OK. overall, i tend towards the second, becuase it's a pain in the ass to esape all the double-quotes in my HTML, my echo statements usulaly end up looking like thi (which, to me, is terrible form) echo INPUT TYPE=\TEXT\ VALUE=\. $hash['var'] .\.. so i usually use this format, which to my eyes is much prettier :) ? INPUT TYPE=TEXT VALUE=?= $hash['var'] ? ? -Original Message- From: James Stevens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: [PHP] General Coding Question Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] General Coding Question
im here to start a flamewar. dont use then. why not use ' ? echo input type=\text\ name=\name\ value=\$name\ echo input type='text' name='name' value='$name' I like the second. it is proper html check it with w3.org. -- Chris Lee [EMAIL PROTECTED] scott [gts] [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on pages with mostly HTML code, the second style is much prefereable, but on pages with mostly PHP code, the first style is usually OK. overall, i tend towards the second, becuase it's a pain in the ass to esape all the double-quotes in my HTML, my echo statements usulaly end up looking like thi (which, to me, is terrible form) echo INPUT TYPE=\TEXT\ VALUE=\. $hash['var'] .\.. so i usually use this format, which to my eyes is much prettier :) ? INPUT TYPE=TEXT VALUE=?= $hash['var'] ? ? -Original Message- From: James Stevens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: [PHP] General Coding Question Does it have any effect on performance in either case if a file is completely done in PHP(1) or interspersed with PHP(2). (1) ?php echo html; ... ? (2) html ... ?php echo $forminput; ? ... Also, and this is personal preference, which is easier to read/debug? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] General Coding Question
You don't use a lot of javascript, do you? Chris Lee [EMAIL PROTECTED] wrote in message 9gr5f9$v2$[EMAIL PROTECTED]">news:9gr5f9$v2$[EMAIL PROTECTED]... im here to start a flamewar. dont use then. why not use ' ? echo input type=\text\ name=\name\ value=\$name\ echo input type='text' name='name' value='$name' I like the second. it is proper html check it with w3.org. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]