42

PHP's Heredoc examples always seem to use EOT (and sometimes EOD) as the seperating string, while it is actually possible to use any string here. This works:

$mystring = <<<EOT
     Foo
     Bar
     Baz
EOT;

While this works as well:

$mystring = <<<MONKIES
     Foo
     Bar
     Baz
MONKIES;

Does EOT actually stand for something and if so, what?

1
  • 1
    "End of text" or maybe "End of tape" (from the old days when using tapes for data storage was standard)? Commented Mar 10, 2011 at 10:46

4 Answers 4

34

​It stands for "End Of Text".​

2
  • Would beginning of text not be a lot more logical? :) Also, what does EOD stand for, then? Commented Mar 10, 2011 at 10:46
  • 11
    No, since it marks the end. What you see at the top is a signal to continue until EOT is spotted. EOD is End of Data.
    – Quentin
    Commented Mar 10, 2011 at 10:46
17

Actually end of text would be ETXEOT is end of transmission.

Reference: ASCII - Wikipedia

1
10

Short answer

Probably End Of Text and End Of Data.

Long answer

The only ones who can tell you definitively what the acronyms mean are the authors of the original (and current) documentation. But based on an early version of the documentation which mentions "here doc text", I think one could plausibly assume that EOT is intended to mean End of Text.

Similarly, the current documentation makes a comparison between Nowdocs and SGML <![CDATA[ ]]> sections, so a reasonable assumption would be that EOD stands for End Of Data.

Sure, there's a definition of EOT in the ASCII standard, but that refers to a single character 0416 and this definition doesn't transfer to anything else unless explicitly stated. About the only thing we can learn from the ASCII standard in this regard is the encoding of the three letters E, O and T.

This is all guesswork of course, but these are the only sensible explanations I can think of. Personally, I prefer to avoid the whole issue by using a single underscore (<<<_).

7

I prefer to go for the TRON reference and use 'EOL' (End of Line).

1
  • 1
    This is funny. I'd mark this as favorite if I could. :D
    – scrfix
    Commented Mar 2, 2014 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.