heredoc help

I’m trying to get the basic heredoc to work but I can’t seem to see what my problem is. Code below:
$author = “eric”;

This is a headline

This is the first line.
This is the second line.

  • Written by $author.

I’ve tried writing it in VIM and pico on a Ubuntu VPS. I also tried writing it in notepad on XP and then SCPing it to the VPS.

The VPS is running PHP Version 5.3.2-1ubuntu4.5.

I’ve also tried copying and pasting the example from below. I copied from Chrome in XP to GVIM, saved it and FTPed it to another account on Hostgator.
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.

/* More complex example, with variables. */
class foo
var $foo;
var $bar;

function foo()
    $this->foo = 'Foo';
    $this->bar = array('Bar1', 'Bar2', 'Bar3');


$foo = new foo();
$name = ‘MyName’;

echo <<<EOT
My name is “$name”. I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital ‘A’: \x41

What am I missing? It can’t get it to work on 2 different hosts.

I figured it out. I thought the display would be different. HTML is removing the extra tabs and returns.

Sponsor our Newsletter | Privacy Policy | Terms of Service