Bash run php script & disable variables inside heredoc multi-line comment

Quote or escape the limit string at the beginning of the here document (heredoc) to disable parameter substitution (variables).

In the following example, escape EOF as \EOF. You can also put the limit string in quotes: "EOF".

php <<\EOF
<?php
echo rand() . "\n";
EOF
php <<"EOF"
<?php
echo rand() . "\n";
EOF
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment