Javascript heredoc

Try ES6 String Template, you can do something like var hereDoc = ` This is a Multiple Line String `.trim() hereDoc == ‘This\nis\na\nMultiple\nLine\nString’ => true You can use this great feature even in older browsers with TypeScript

HEREDOC Returning unexpected end

You have a whole bunch of spaces (9 to be exact) after the EOT; in the loop. From the manual … there may not be any spaces or tabs before or after the semicolon … Why are you wrapping the $output variable inside a HEREDOC string? I’d just change the loop to printf(‘<tr><td align=”left”>%s</td><td align=”left”>%s</td></tr>’, … Read more

HEREDOC interfering with code indentation

Thank goodness this feature has finally landed in php 7.3 via RFC: Flexible Heredoc and Nowdoc Syntaxes So now your example can cleanly be written as: class myclass { function __construct() { $a = some_code(); $b = some_more_code(); $x = <<<EOT line1 line2 line3 line4 EOT; $c = even_more_code(); $b = still_more_code(); } }

Use a variable within heredoc in PHP

Your heredoc needs a little modification (because it’s actually Nowdoc!): echo <<<EX <p>Game: {$data[‘game_name’]}<br/> the owner of the game is {$data[‘game_owner’]} </p> EX; Heredoc identifiers (unlike nowdoc ones) cannot be quoted. ‘EX’ needs to become EX. You’re confusing Nowdoc with heredoc. Complex data types in strings must be surrounded by {} for them to be … Read more

How to suppress variable substitution in bash heredocs

Quote the delimiter: cat <<-“EOF” > somefile.sh Do not print current value of $1 instead evaluate it later. EOF This results in: $ cat somefile.sh Do not print current value of $1 instead evaluate it later. Documentation The format of here-documents is: <<[-]word here-document delimiter No parameter and variable expansion, command substitution, arithmetic expansion, or … Read more