Click to See Complete Forum and Search --> : Can't get heredocs to work
spufi
01-08-2004, 04:39 PM
I went and did the basic install and I'm playing around with heredocs, but for some reason when I try to view the output I keep getting nothing. Is there something I need to do with the setup to allow heredocs to show up, or am I missing something? Even something as simple as this doesn't work.
print <<<DONE
Hi
DONE;
Yes, the heredoc syntax works with PHP 4. Not too common to use that with PHP, though.
<?PHP
echo <<<DONE
Hello World.
DONE;
?>
spufi
01-08-2004, 04:53 PM
And that code doesn't show any output either. I have PHP 4 point something.
Hmmm... not sure. I don't believe there are any configurable options with that. Here's (http://us4.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) some info on it in the manual, though. I did try the code I posted (and your's above) and both work fine on my local server - PHP 4.3.3.