Anirudh Zala wrote:
#2 When your data is static, use 'single quotes' to tell PHP to use it "as it
is", if dynamic then should not be enclosed by ANY quote.
#3 If you have mixture of static+dynamic then use $dynamic.'I am static' style
to concat dynamic and static data.
If I wanted to code like that, I'd be coding in Java.
I did a long stint of programming in Perl, which offers you about
30,000 ways to quote text.
Here are my rules for PHP.
(1) Use ?>...some HTML...<?php as much as feasible
(2) Avoid heredoc -- it's particularly treacherous in PHP
(3) Use " in most situations. Use \ to escape ", $ and \.
(4) Make a habit of writing {$like_this}
Convention (3) turns out to be an effective convention
cross-language. Double quotes work the same way in shell scripts, perl
scripts and other places. It might not be the most elegant syntax, but
it works well.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php