If reading php manual about Heredoc
- it is same as a string with double-quotes around
So, anything we can do inside such a string, we can do inside of Heredoc.
If you can put the contents of a file inside of Heredoc would depend on what is inside file.
If it is text and variables, and some expressions, it should be okay.
Using curly braces For example:
echo "This square is {$square->width}00 centimeters broad."; // Works
echo "This works: {$arr[4][3]}";
This is a way, if the file contents is only text/variables/expressions.
That is anything that can be put inside a STRING.
It is basically same as examples above.
<?php
$filestuff = get_file_contents( $filename );
$footer = <<<FOOT
this is begining of my footer
$filestuff
this is end of my footer
FOOT;
?>
I am a bit unsure where actually limit is, what can be put into string.
I may do some experiments of my own to find out.