php people
- Started
- Last post
- 10 Responses
- section_014
I guess this could apply to any language. When you are echo'ing strings that have quotes do you:
a) echo "<div id='test'>";
or
b) echo '<div id="test">';
I do the "a" version.
Just curious what others do.
- akoni0
A
- drgss0
B, because i just feel double quotes are more native to HTML,
W3C validator takes both, but single quotes in html used to cause trouble with some very old browsers, which are probably not used anymore
- taxiguerrilla0
C) echo "<div id=\"test\">"
?
- maximillion_0
$output = <<<OUTPUT
<div id='test'>
OUTPUT;echo $output;
- fusionpixel0
$start = "<div ";
$id = "test";
$end = "</div>";echo $start . 'id="' . $id .'">'.$end;
- janne760
STOP POSTING ALL THIS CODES I GOTS SERVER ERRORS A MINUTE AGO!
;)
- heavyt0
B. double quotes are interpreted in PHP, so, it will slow your script down because it is looking for vars to replace inside. Using single quotes means it interprets it as a string, and will be faster.
no exceptions
- sherm0
B...
You'd only use something like A if you are echoing the value of a $variable...
- creez0
double quote encompassing single quote.period
- creez0
php most boring language ever