Hi,

Tuesday, September 9, 2003, 2:03:34 PM, you wrote:
mb> Hi everyone,

mb> Could somebody please explain to me the difference
mb> between single quotes and double quotes in PHP.  It
mb> seems like they can be used interchangeably a lot in
mb> PHP but not always. For example:

mb> This works:
mb> header('Location: http://somedomain.com')

mb> This does not work:
mb> header('Location: $url')

mb> This works:
mb> header("Location: $url")


mb> Why???  Sorry if this has been asked before, but I
mb> didn't find a suitable answer in the archives.  TIA.

mb> Mike

mb> __________________________________
mb> Do you Yahoo!?
mb> Yahoo! SiteBuilder - Free, easy-to-use web site design software
mb> http://sitebuilder.yahoo.com

PHP will not parse single quoted strings but will do for double quoted
strings. So if you don't need it to do $val substitution or "\n" type
stuff use single quotes.
You can always use the dot operator (.) to mix quotes and variables like this:

echo '<table border="1" width="'.$width.'">'."\n";

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to