Please help to explain a statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexchui
Forum Newbie
Posts: 2
Joined: Tue Nov 11, 2008 9:14 pm

Please help to explain a statement

Post 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!
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Please help to explain a statement

Post by Syntac »

That's something called heredoc syntax. You can find information on it here and here.
alexchui
Forum Newbie
Posts: 2
Joined: Tue Nov 11, 2008 9:14 pm

Re: Please help to explain a statement

Post by alexchui »

got it

Thanks a lot
Post Reply