1
2<?php
3$str = <<<EOD
4Example of string
5spanning multiple lines
6using heredoc syntax.
7EOD;
8
9/* More complex example, with variables. */
10class foo
11{
12 var $foo;
13 var $bar;
14
15 function __construct()
16 {
17 $this->foo = 'Foo';
18 $this->bar = array('Bar1', 'Bar2', 'Bar3');
19 }
20}
21
22$foo = new foo();
23$name = 'MyName';
24
25echo <<<EOT
26My name is "$name". I am printing some $foo->foo.
27Now, I am printing some {$foo->bar[1]}.
28This should print a capital 'A': \x41
29EOT;
30?>
31
32