note 30476 rejected from function.define by didou
| From: | didou@php.net | Date: | Fri, 12 Sep 2003 12:13:49 +0000 |
| Subject: | note 30476 rejected from function.define by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56372@lists.php.net to get a copy of this message | ||
Note Submitter: Jack@soinsincere.com
----
Here's an extremely useful (undocumented?) feature.
You can include the heredoc syntax in an constant like so:
define(INDEX_HEADER,
<<<HTML
<html>
<head><title>Heredoc constants</title></head>
<body>
HTML
);
Note: The closing parenthesis and semicolon _must_ occur on a new line after the ending heredoc tag.
From what I've found, you can use a heredoc'd constant in any context you would use a
constant of string value. For instance:
print INDEX_HEADER."\nPage Content\n".INDEX_FOOTER;