header


Heredoc

Heredoc syntax (<<<) is the third method of wire separation. In the Heredoc syntax, the identifier is given after this heredoc operator <<<, and soon a new line begins to be written in any text. To close the quotation, the string follows them and is given the same direction. This lock indicator should start on a new line without a white space or tab.

Valid Example

$input = <<<testHeredoc Welcome to knowledge 2life. I am enjoying this. testHeredoc; echo $input;

output:

Welcome to knowledge 2life. I am enjoying this.

Nowdoc Example:

$input = <<<'testNowdoc' Welcome to knowledge 2life. testNowdoc; echo $input; // Directly printing string without any variable echo <<<'Nowdoc' <br/> Welcome to knowledge 2life. Learning PHP is fun in knowledge 2life. Nowdoc;

output:

Welcome to knowledge 2life. Welcome to knowledge 2life. Learning PHP is fun in knowledge 2life.