What does <<< EOT mean in PHP?

Nathe C

New member
I have a script that looks like this designed for getting information about my server:

<html>
<body>
<table width='100%' border='1'>

<?php

foreach ($_SERVER as $key => $value)
{
echo <<<EOT

<tr>
<td width='25%'>
<b>$key</b>
</td>
<td>
$value
</td>
</tr>
EOT;
}

?>
</table>
<br/><br/>
</body>
</html>

My question for you is that I want to know what echo <<<EOT means. I've been searching this everywhere and so far got no results.

Thanks,

- Nathe
 
That's so called heredoc syntax. EOT, i guess, in that sample is supposed to mean "end of text", but it can be anything MYSTRING, for example.

heredoc starts with the <<< operator and an identifier (EOT in your case). After it you can type your text in more lines as if it were a double quoted string. It means that you can use variables inside the heredoc (your sample has $value in there). If you are ready with your text you only need to write the identifier again in a new line.
 
That's so called heredoc syntax. EOT, i guess, in that sample is supposed to mean "end of text", but it can be anything MYSTRING, for example.

heredoc starts with the <<< operator and an identifier (EOT in your case). After it you can type your text in more lines as if it were a double quoted string. It means that you can use variables inside the heredoc (your sample has $value in there). If you are ready with your text you only need to write the identifier again in a new line.
 
Back
Top