0

Possible Duplicate:
In PHP, what does “<<<” represent?
Reference - What does this symbol mean in PHP?

can anyone explain me what means those chars? belowe variable contains string:

$txt = <<<EOD
this is simple string
EOD;

$x = ...

can I change <<< for ' ?

Community
  • 1
  • 1
Krystian
  • 458
  • 1
  • 9
  • 26
  • 1
    google -> `what means << – Alexander Larikov Oct 11 '12 at 09:34
  • thank you @Quentin I didint know that this post exists – Krystian Oct 11 '12 at 09:37
  • I have to agree that it's a bit difficult to search for `<<<` here on SO and on Google actually. However if you start typing `<<<` on the PHP manual search page (http://us3.php.net/manual-lookup.php) you get `string` as first suggestion in the typeahead list. This is not a critic, I just want you to make aware of the possibilities. – Felix Kling Oct 11 '12 at 09:47

2 Answers2

3

It's what is called a heredoc.

Heredoc

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.

Reference: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

Menztrual
  • 40,867
  • 12
  • 57
  • 70
0

It is called here-document.

For general info:

en.wikipedia.org/wiki/Here_document

For php specific info:

http://php.net/manual/en/language.types.string.php

And it is NOT the same as '...'

Erwin Moller
  • 2,375
  • 14
  • 22