• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1157
  • Last Modified:

<<EOT PHP

What is <<EOT and what are the advantages/usage of it in php ?
0
sahanz
Asked:
sahanz
4 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
check out the HEREDOC syntax of php:
http://php.net/manual/en/language.types.string.php
0
 
Ray PaseurCommented:
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
 
innotionentCommented:
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
 
Ray PaseurCommented:
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
 
sahanzAuthor Commented:
Thank You
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now