You are here: Re: [PHP] Newbie question: qutoes? « PHP « IT news, forums, messages
Re: [PHP] Newbie question: qutoes?

Posted by Jochem Maas on 03/06/05 20:40

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 :-)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация