So i was trying to debug this code:
header('Location: http://secure.mysite.com/managepicture.php?var=$var');
and realized by changing the single quotes to double quotes, it worked... But how do you know when to use single quotes and when to use double quotes?
Best,
Chris
Using single quotes versus double quotes (explanation?)
Moderator: General Moderators
-
xpiamchris
- Forum Newbie
- Posts: 10
- Joined: Thu Jan 15, 2009 4:17 pm
- andym01480
- Forum Contributor
- Posts: 390
- Joined: Wed Apr 19, 2006 5:01 pm
Re: Using single quotes versus double quotes (explanation?)
Single quotes is as is.
Double quotes allows variables like $var to be interpreted for value rather than just as a sequence of characters.
another example
Double quotes allows variables like $var to be interpreted for value rather than just as a sequence of characters.
another example
Code: Select all
$hello='Hi';
echo "$hello"; //outputs Hi
echo '$hello'; //outputs $hello