PHP HERE Documents EOF

Crash Course PHP HERE Documents EOF

Using PHP HERE documents allows you to print or create custom, readable strings within EOF tags.

$var1 = "Hello";
$var2 = "World";
echo <<<EOF

Echoing heredoc. My variables and text output just fine. Variable 1 is $var1 and Variable 2 is $var2.


$make_eof_variable = <<<EOF

Hey Variable 1 called $var1! I can add the variables within the EOF tags then output the variable anywhere on the page!


echo $make_eof_variable;