php q about quotes ' "
- Started
- Last post
- 5 Responses
- to
Can someone tell me when i have to use single Quotes ‘ ‘ and when i use the double ones ” “?
Is:
“This” for a string and
‘this’ for plain text?
- blaw0
My personal rule of thumb is to use single for php-related things (variable = 'value';) and double for strings, values within HTML tags, etc.
- ********0
I follow blaw's rules. You can work the opposite tho - ive seen shit done both ways.
- unlx0
Double quotes when using variables, single quotes when not, oui? If you need to parse any $variables in your string, double quotes. If the text is literal, there's no discernible difference. Non?
$Text = "this text here";
echo "$Text"; // prints this text here
echo '$Text'; // prints $Text.Or am I missing the crux of the question?
_
- u did understand my question :D
to - this should be echo $text;maximillion_
- u did understand my question :D
- neverblink0
I always use double.. and escape the double if they arn't the edges of a variable..
$variable = "
<a href=\"link.php\" >" .$link." </a>";
- to0
thank you for the response...i think i got it now.