String Functions in PHP [heredoc syntax]

The heredoc syntax:
In addition of the single quote and double quote syntaxex, PHP provides another way to specify a string called heredoc syntax. This syntax turns out to be a extremely useful for specifiying large chunks of variable-interpolated text, because it spares you from the need to escape internal quotation marks. It is especially useful in creating pages that contain HTML Forms.

The Operator in the heredoc syntax is < <

For Example:

[php]
<?php
$content = <<<EOD
Example of string’s
spanning multiple lines
using heredoc syntax.
EOD;
?>
[/php]

Permanent link to this article: https://blog.openshell.in/2011/08/string-functions-in-php-heredoc-syntax/

Leave a Reply

Your email address will not be published.