[KLUG Members] php and quotation marks

Richard Harding rick at ricksweb.info
Tue Sep 27 14:00:06 EDT 2005


On Tue, 2005-09-27 at 13:29 -0400, bill wrote:
> On Tue, 2005-09-27 at 10:59, Adam Tauno Williams wrote:
> 
> > Right use single outer quotes, always.
> 
> Just my experience here:  I used to do that and it was a problem.  
> 
> Assume we're talking about displaying HTML.  If I start with single
> outer quotes (') I often have to change the code later to contain a
> variable.  If I started with single quotes it wouldn't display the value
> of the variable.  Bummer.  I'd have to go back and change them to double
> quotes, and then also change any other quotes they affected.  AAAARGH.  
> 
> So, I always start and end with double quotes (") and escape any other
> double quotes inside there.  I hardly ever use single quotes unless I
> really need them.
> 
> kind regards,
> 
> bill
I'm the opposite. I much prefer to see a separation of html and
variables. By using single quotes you're forced to use the . to
concatenate the string and it's much easier to see where content is
coming from than searching strings for $ that may or may not be there. 

Not to mention that double quotes are slower since the string is parsed
by the php engine to check for variables. Why force the parsing when
it's not necessary?

Rick



More information about the Members mailing list