How do I write the <<<TOC thing in PHP?

I forgot how to write the one command that looked something like this

<<TOC


bla bla

bal bal


TOC;

how was it written again?


这些被称为heredocs。


It works like this:

$foo = <<<TOKEN
multi
line
string
TOKEN;

TOKEN can be anything you want as long as you being and end the heredoc with the same exact thing.


Yes that is corect syntax for using a heredoc, however make sure that TOC; line is not indented or it will not work. FYI you can call it anything you want such as HTML not just TOC.

链接地址: http://www.djcxy.com/p/58452.html

上一篇: 在PHP中==和===有什么区别

下一篇: 我如何在PHP中编写<<< TOC东西?