echo <<< tag

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
SpongeBob
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Oct 22, 2019 7:28 am

Tue Oct 22, 2019 7:43 am

The following code works:

Code: Select all

echo <<<TEXT
<p>Howdy world!</p>
TEXT;
?>
What does '<<<' do and what is it called? I searched the PHP documentation but did not find an explanation as to how the above code works.

Thank you for any assistance.
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 852
Joined: Mon Feb 22, 2016 5:52 pm

Tue Oct 22, 2019 8:03 am

It's called heredoc it is explained better in the given link than I could. There are still a few gotchas in there so have a play with it.
SpongeBob
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Oct 22, 2019 7:28 am

Tue Oct 22, 2019 8:29 am

Brilliant! Thank you!
Post Reply