|
Posted by Jochem Maas on 01/20/05 21:47
tg-php@gryffyndevelopment.com wrote:
> I believe HTML uses ' and " interchangeably. No real difference. Well, it also depends on the HTML rendering engine too I guess. IE might do it ok but Firefox might not.. things like that. But I think as far as the spec goes, you can use both. In a lot of cases, as long as there are no spaces involved, you can go without the quotes too but that's just really poor coding practice I think.
>
AFAICR " must be used if you want to be compliant - its also obvious
that you can get away with murder in an HTML page ;-)
> I believe they allow single and double quotes to help accomodate client side scripting languages like JavaScript where you might have to echo text but still be able to break out to perform a function or concatenate a variable or something. If a scripting language only let you use double quotes, then you have the option of using single quotes in the HTML you're echoing. Or vice versa.
>
> Firefox's Web Developer extension (which I highly recommend for web developers) will tell you if it's using W3 standard (strict), loose or...umm.. something else.. for it's rendering of the web page. That is, if the HTML it's interpreting meets strict specs, loose specs, or is just sloppy as crap but it's going to do what it can anyway... basically which facet of it's rendering engine is being used to display the page.
>
> -TG
>
>
> = = = Original message = = =
>
> I always thought quoting values in HTML had to be dome with double
> quotes ("). however on reeding some stuff in the PHP manual the
double quotes will cause the string to be interpolated, using single
quotes will not - e.g.
<?
$test = 'test';
echo 'this is a $test'; echo "\n";
echo "this is a $test"; echo "\n";
so its 'recommended' to use doubles only when needed, (convienience and
readability can be requirements :-)
oh and ALWAYS use double quotes if your sending a bit of test code
because that makes it easy to cut'n'paste it into a php -r command on a
*nix shell.
> examples use single quoted. Single quotes are allot more convenient
> as I use double quotes generally for quoting strings. So are the two
> totally synonymous in HTML?
>
> Ben
Navigation:
[Reply to this message]
|