Re: Is there an alternative to double quotes?
| From: | Dean Householder | Date: | Wed, 23 Oct 2002 17:23:45 +0000 |
| Subject: | Re: Is there an alternative to double quotes? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121137@lists.php.net to get a copy of this message | ||
You can also try:
print "<form action=\"registertest.php\" method=\"post\">
<input type=\"hidden\" name=\"fname\"
value=\"$fname\">";
Notice that you don't have to leave the quotes to print a variable if you
use double quotes. If you use single quotes, it will assume a literal
string and you will have to leave the quotes to use a variable.
You can also try the "here document" method like:
print <<<END
Here you can type all the "'s you want and it's not going to matter.
"'"'"'''"""""''
This will go on until it hits a new line that has exactly END;
See, like this:
END;
Try it out.
Dean
"Matt Schroebel" <MSchroebel@hsus.org> wrote in message
news:D4DB668A680B2549AE977FB0B193E2E80373CE@email.hsus.org...
You can do:
echo '<form action="registertest.php" method="post">
<input type="hidden" name="fname" value="' . $fname
.'">';
Not as clean but works ... and gets messy if you need a lot of newlines.
> -----Original Message-----
> From: Glen Lee Edwards [mailto:glen@fcwm.org]
> Sent: Wednesday, October 23, 2002 10:08 AM
> To: php-general@lists.php.net
> Subject: [PHP] Is there an alternative to double quotes?
>
>
> PERL has an alternative to using double quotes if you have to
> print one
> or several lines that contain numerous double quotes:
>
> print qq(<form action="registertest.php" method="post">
> <input type="hidden" name="fname" value="$fname">);
>
> The qq() function allows you to use double quotes, and still allows
> variable interpolation. Does PHP have a similar function, or
> do I have
> to backslash all double quotes all the time?
>
> Regards,
>
> Glen