You can use your own delimiters in two ways: heredoc syntax and nowdoc syntax.
Heredoc is the equivalent of using double quotes:
Nowdoc works in the same way as single quotes: no variable substitution or escaping takes place; the string is used entirely as-is.
Heredoc syntax works like this:
$myString = <<< DELIMITER (insert string here) DELIMITER;
DELIMITER is the string of text you want to use as a delimiter.
It must contain just letters, numbers, and underscores, and must start with a letter or underscore.
Traditionally, heredoc delimiters are written in uppercase, like constants.
Nowdoc syntax is similar; the only difference is that the delimiter is enclosed within single quotes:
$myString = <<<'DELIMITER' (insert string here) DELIMITER;
Here's an example of heredoc syntax in action:
<?php $religion ='hi';/*from w w w .j av a2 s . c o m*/ $myString = <<< END_TEXT "' $religion,'hi'test test!'" END_TEXT; echo " $myString"; ?>
Here's the same example using nowdoc syntax instead:
<?php $religion ='hi';/*from w ww.ja v a 2 s . c om*/ $myString = <<<'END_TEXT' "'$religion,'test' test test!'" END_TEXT; echo " $myString"; ?>