Re: Newbie question: qutoes?
| From: | rory walsh | Date: | Sun, 06 Mar 2005 18:44:35 +0000 |
| Subject: | Re: Newbie question: qutoes? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-210105@lists.php.net to get a copy of this message | ||
Thanks guys, that clears up a lot! Cheers, actually I have to say goodbye to broadband for a while so I hope that I can make it on my own! That's why I have been asking all these obvious little questions! Cheers,
Rory.
Jochem Maas wrote:
rory walsh wrote:Can anyone tell me if there is a difference between double quotes and single quotes? Cheers, Rory.apart from the visual difference :-)... yes. with double quotes string interpolation is done. whats that? run this code to see the difference: <?php $varA = 123; echo ' this is $varA'; echo " this is $varA"; ?> basically use double quotes only when you need it... needing it includes times when using double quotes saves you having to escape _lots_ of single quotes, i.e. when it makes code easier to read (JMHO) e.g.: $str = '\'this\' \'is\' a \'stupidly\' \'quoted\' string'; $str = "'this' 'is' a 'stupidly' 'quoted' string"; --- so now you have at least 2 things to google: 1. string interpolation (+ PHP) 2. string/char escaping (+ PHP) have fun :-)