[nycphp-talk] single quote vs. double quote
Ken Robinson
kenrbnsn at rbnsn.com
Tue Apr 3 08:51:43 EDT 2007
At 08:43 AM 4/3/2007, tedd wrote:
>I'm not sure if what you are saying includes this, but I use double
>quotes all the time in php for producing html. For example:
>
>[1] echo("$myResult <br/>");
>[2] echo('<a href="mydomain.com/mywidget.php" >$myResult</a>');
>
>The use of double quotes in [1] allows me to print something without
>having to use the dot operator.
How you write number [1] comes down to personal preference. I'd
rather write it as:
echo $myResult . '<br/>';
In number [2], I hope you realize that the string '$myResult' will be
treated as a static string and will not be evaluated.
Also, since "echo" is a language construct and not a function, the
parenthesis are not required.
Ken
More information about the talk
mailing list