I have two nested statements inside the construction of a string with <<<EOF
After the statements I get an error that I don't understand when continuing adding to the string.
The error is unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
function foo_bar() {
$phrase = "hello world";
$string = "";
if (0 == 0) {
$string .= <<<EOF
<b>{$phrase}</b>
EOF;
if (0 == 0) {
$string .= <<<EOF
<i> of mine</i>
EOF;
}
/* comment out to see the error
$string .= <<<EOF
<u> - the END</u>
EOF;
*/
}
return $string;
}
add_shortcode('foobar', 'foo_bar');
So the gist of the discussion in the comments above.
Check for trailing spaces after
EOF;