PHP expression <<<EOB

萝らか妹 提交于 2019-11-26 13:51:39

This is known as heredoc syntax. The documentation will tell you everything you need to know.

Essentially, however:

A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

The closing identifier must begin in the first column of the line. Also, the identifier must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore.

So EOB is just what the author chose as his delimiter, not really sure what it stands for in his case but the identifier can be whatever you want.

wazoox

Just for the sake of completeness, Heredoc in PHP is inherited from Perl, which itself inherited it from the Bourne shell.

It´s called heredoc and is described in the manual.

Brian

The official term is 'here document' I believe, usually shortened to 'heredoc'.

This is called heredoc syntax. It lets you treat large blocks of text like a string. It allows for newlines as well. Variables can be inserted into the block of text, just like using the double quotation marks for strings.

A more useful explanation can be found on PHP's own website: http://php.net/manual/en/language.types.string.php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!