|
Posted by Ian Hobson on 12/02/07 20:12
MangroveRoot wrote:
> I've looked in various manuals and tutorials,
> and they cover the obvious situations, but not this one:
>
>
>
> Is there some way I can "escape" or "quote" the singlequote in the variable
> so that it will just be taken as a value (I guess)
> rather than as something to be concatenated with what's around it
> and thus interacting with the quotes around it?
Indeed there are many ways to do what you want.
I won't repeat the manual here - it does a reasonable job of explaining
the options - its just that there are so many it gets complicated.
What you need is either to escape the double quotes, and let the double
quote processing convert $var into its value. Here you echo a single
processed string, thus.
<?php echo "
<H1><IMG SRC=\"_images/_rock/Zacs World.gif\" ALT=\"$title\"></H1>
"; ?>
Or you can use single quotes, and the concatenation operator dot (.)
which joins the strings it appears between. This means you echo the join
of three strings thus.
<?php echo '
<H1><IMG SRC="_images/_rock/Zacs World.gif" ALT="'.$title.'"></H1>
'; ?>
Regards
Ian
Navigation:
[Reply to this message]
|