Page 1 of 1

Please help to explain a statement

Posted: Tue Nov 11, 2008 9:24 pm
by alexchui
Dear All,

I'm reading a book about AJAX and PHP and there has a statement like this :

$xml = <<< PROLOG
<?xml version="1.0" encoding="iso-8859-1"?>
PROLOG;

I would like to know is it some kind of shorthand for assigning the string '<?xml version="1.0" encoding="iso-8859-1"?>' to $xml?
And is it "<<<" a kind of operator?

Many thanks!

Re: Please help to explain a statement

Posted: Tue Nov 11, 2008 9:35 pm
by Syntac
That's something called heredoc syntax. You can find information on it here and here.

Re: Please help to explain a statement

Posted: Tue Nov 11, 2008 9:45 pm
by alexchui
got it

Thanks a lot