Re: two ?s: '' vs ""; function to post form data

From: Date: Wed, 18 Oct 2000 03:26:21 +0000
Subject: Re: two ?s: '' vs ""; function to post form data
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-20775@lists.php.net to get a copy of this message
At 11:10 PM -0400 10/17/00, Daniel Convissor wrote:
Hey Alan:
1. I've been reading a few php articles today, and so far I've not come across a clear distinction between variables defined using '' and those using "". I've read those are both strings, but what is the difference?
"It's partly style, but"    single quotes don't need escaping
'It\'s partly style, but' single quotes in text need escaping
There's another difference that's pretty important: <?php $color = "brown"; $sentence1 = "How now $color cow.\n"; $sentence2 = 'How now $color cow.\n'; echo $sentence1; echo $sentence2; ?> Run that script and view the source of the page. You will see something like: How now brown cow. How now $color cow.\n Variables defined with single quote marks are explicitly set to the exact text inside them, whereas double-quoted variables will have variables and escaped characters inside evaluated before they are set. cheers, -- Marc Antony Vose http://www.suzerain.com/ In doing good, avoid fame; in doing evil, avoid punishment. -- Traditional Taoist Saying

« previous php.general (#20775) next »