Please explain me and when we echo $form; then it shows. please explain this.

$form=<<<POST
<form method="post" action="">
</form>

POST;

Thanks in Advance...

Recommended Answers

All 2 Replies

That's a short way of assigning a variable a value that spans multiple lines and includes special characters that would normally interfere with the PHP language.

It's called NOWDOC (see http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc)

Consider this example:

$text = <<<SPECIAL_LABEL
The quick brown
fox jumps over
the lazy dog.
SPECIAL_LABEL

This assigns the sentence (including line breaks) to the variable $text.

The syntax is:

$variable = <<<LABEL
contents go here....
LABEL

So, in your example, the value stored in $post is:

<form method="post" action="">
</form>

Thanks. great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.