Re: Single Quotes vs Double Quotes

From: Date: Tue, 09 Sep 2003 04:37:41 +0000
Subject: Re: Single Quotes vs Double Quotes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162038@lists.php.net to get a copy of this message
Hi, the $ sign inside single quotes is just a dollar sign. When you place it inside double quotes it's the start of a variable name. This is because what is inside single quotes are unparsed while whats inside double quotes are parsed. For this reasong if you are having to print out lengthy string literals you should use single quotes. else you can always safely use doubles. micro brew wrote:
Hi everyone, Could somebody please explain to me the difference between single quotes and double quotes in PHP. It seems like they can be used interchangeably a lot in PHP but not always. For example: This works: header('Location: http://somedomain.com') This does not work: header('Location: $url') This works: header("Location: $url") Why??? Sorry if this has been asked before, but I didn't find a suitable answer in the archives. TIA. Mike __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
-- http://www.radinks.com/upload Drag and Drop File Uploader.

« previous php.general (#162038) next »