Anirudh Zala wrote:
Please remember below rules while writing PHP expressions.

#1 There is practically NO use of "double quotes" in PHP in writing expressions EXCEPT expanding sequences like converting "\n" into newline, "\t" to tabulator (in regex etc.). Which means you should not use "double quotes" at any other place than above.

#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.

When you use "double quotes" PHP will try to EXPAND everything which is enclosed in "double quotes" which means variables will be expanded, static string will be looked for constants first and if not found then will be used as it is and then finally expression will be prepared.

Hope these will clear your thoughts about '' vs. "" quotes.

Thank you very much. I'll print it out and pin it to my forehead.

David
_______________________________________________
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

Reply via email to