I get a syntax error when I use heredoc syntax to push values into array
$theArray = array();
$theArray[] = <<<EOT
some values here
EOT;
$theArray[] = <<<EOT
some values here
EOT;
I can't figure out what's wrong with this code.
I get a syntax error when I use heredoc syntax to push values into array
$theArray = array();
$theArray[] = <<<EOT
some values here
EOT;
$theArray[] = <<<EOT
some values here
EOT;
I can't figure out what's wrong with this code.
It should work just fine. Doing a print_r($theArray);
would output:
Array
(
[0] => some values here
[1] => some values here
)
If you're getting parse errors, double-check and make sure there is no whitespace after the three angled brackets in the beginning and/or end.