Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php what does <<< mean?

Tags:

syntax

php

In the following code from http://us2.php.net/manual/en/language.oop5.properties.php what does the <<< symbol mean?

<?php
class SimpleClass
{
   // invalid property declarations:
   public $var1 = 'hello ' . 'world';
   public $var2 = <<<EOD
hello world
EOD;
   public $var3 = 1+2;
   public $var4 = self::myStaticMethod();
   public $var5 = $myVar;

   // valid property declarations:
   public $var6 = myConstant;
   public $var7 = array(true, false);

   // This is allowed only in PHP 5.3.0 and later.
   public $var8 = <<<'EOD'
hello world
EOD;
}
?>
like image 875
James Andino Avatar asked May 06 '10 10:05

James Andino


People also ask

What is <<< EOD in PHP?

EOD = End Of Data, EOT = End of Text.

What does <? PHP mean in PHP?

What Does PHP Mean? The abbreviation PHP initially stood for Personal Homepage. But now it is a recursive acronym for Hypertext Preprocessor.

What is the mean of @symbol in PHP?

Hello @kartik, The @ symbol is the error control operator ("silence" or "shut-up" operator). It makes PHP suppress any error messages (notice, warning, fatal, etc) generated by the associated expression. It works just like a unary operator, for example, it has a precedence and associativity.

What does 3 dots mean in PHP?

This is literally called the ... operator in PHP, but is known as the splat operator from other languages. From a 2014 LornaJane blog post on the feature: This feature allows you to capture a variable number of arguments to a function, combined with "normal" arguments passed in if you like.


1 Answers

It's called Heredoc syntax and can be used to assign string values.

like image 95
Tatu Ulmanen Avatar answered Sep 17 '22 23:09

Tatu Ulmanen