PHP expression

This is known as heredoc syntax. The documentation will tell you everything you need to know. Essentially, however: A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation. The closing … Read more

In PHP, what does “

That’s heredoc syntax. You start a heredoc string by putting <<< plus a token of your choice, and terminate it by putting only the token (and nothing else!) on a new line. As a convenience, there is one exception: you are allowed to add a single semicolon after the end delimiter. Example: echo <<<HEREDOC This … Read more

Using variables inside a bash heredoc

In answer to your first question, there’s no parameter substitution because you’ve put the delimiter in quotes – the bash manual says: The format of here-documents is: <<[-]word here-document delimiter No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any characters in word are quoted, the delimiter is the … Read more

How to assign a heredoc value to a variable in Bash?

You can avoid a useless use of cat and handle mismatched quotes better with this: $ read -r -d ” VAR <<‘EOF’ abc’asdf” $(dont-execute-this) foo”bar”” EOF If you don’t quote the variable when you echo it, newlines are lost. Quoting it preserves them: $ echo “$VAR” abc’asdf” $(dont-execute-this) foo”bar”” If you want to use indentation … Read more