Posted on 2010-11-15
Last Modified: 2012-05-10
What is <<EOT and what are the advantages/usage of it in php ?
Question by:sahanz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 125 total points
ID: 34136164
check out the HEREDOC syntax of php:
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 34136208

$money = 100.00;
$thing = <<<ENDTHING
In here you can put anything you want - lots of lines of HTML, for example.
You can substitute values, for example, $money

echo $thing;

Assisted Solution

innotionent earned 125 total points
ID: 34145206

here is a decent explanation.
I don't use it myself. However apparently it's an easier way to mix alll your code together.
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 34145427
Although I have not verified it, this looks like an interesting note.

I find it incredibly useful when you want to separate your code and data from your presentation layer.  You create the values for all your variables, like the $money var in the post at ID:34136208, then you echo a HEREDOC string with the embedded variable names.  In some cases, your HEREDOC string can be the HTML of the entire web page.  Very  nice encapsulation!

Author Closing Comment

ID: 34179723
Thank You

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with mod_substitute 18 76
Building a glossary into your website 9 58
How do i use the await event in php echo 5 43
history of pages 7 52
This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question