Solved

<<EOT PHP

Posted on 2010-11-15
5
1,130 Views
Last Modified: 2012-05-10
What is <<EOT and what are the advantages/usage of it in php ?
0
Comment
Question by:sahanz
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 34136164
check out the HEREDOC syntax of php:
http://php.net/manual/en/language.types.string.php
0
 
LVL 109

Assisted Solution

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

$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
ENDTHING;

echo $thing;
0
 
LVL 5

Assisted Solution

by:innotionent
innotionent earned 125 total points
ID: 34145206
http://onlamp.com/pub/a/php/2003/04/10/php_heredocs.html

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

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.
http://www.php.net/manual/en/language.types.string.php#86365

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!
0
 
LVL 1

Author Closing Comment

by:sahanz
ID: 34179723
Thank You
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 39
tutorial for ebay api 3 36
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 38
What does != "" mean in programming 8 42
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

825 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