• 5

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Heredoc: what does the commonly used 'EOT' actually mean?

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

While this works as well:

$mystring = <<<MONKIES

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

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 (<<<_).

  • 3
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions