Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

echo <<<HTML in PHP

Tags:

php

echo

I need to work with some scripts, in which I found this:

$data = <<<DATA
MIN={$min}
INVOICE={$invoice}
AMOUNT={$sum}
EXP_TIME={$exp_date}
DESCR={$descr}
DATA;

Can someone provide more info around $somevar = <<<DATA... and echo <<<HTML... it seems hard to find useful info about this.

like image 689
user1537222 Avatar asked Aug 10 '26 19:08

user1537222


1 Answers

http://www.php.net/manual/de/language.types.string.php#language.types.string.syntax.heredoc

which says: A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

like image 190
mdo Avatar answered Aug 12 '26 11:08

mdo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!