note 64378 deleted from function.echo by bjori
| From: | bjori@php.net | Date: | Thu, 13 Apr 2006 11:17:44 +0000 |
| Subject: | note 64378 deleted from function.echo by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107969@lists.php.net to get a copy of this message | ||
Note Submitter: PHPer
Reason: in docs
----
"This is a beauty for lots of text, really. And easy to read, if you're a PERL or shell
person.
echo <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!
END; "
I just wanted to note that the last line "END;" must not have any whitespace before it..
so if your echo statement is indented, which 99% of the time it would be, make sure the echo
terminator is not indented at all
This can also be used in variable assignments.. like SQL statements.
$SQL = <<<END
SELECT * FROM MyTable
WHERE UserID = $UserID
END;
But then, I don't see the benifit of doing that vs...
echo "
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!";
or
$SQL = "
SELECT * FROM MyTable
WHERE UserID = $UserID";
-PHPer