note 30476 added to function.define

From: Date: Wed, 19 Mar 2003 09:22:50 +0000
Subject: note 30476 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-45511@lists.php.net to get a copy of this message
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; -- http://www.php.net/manual/en/function.define.php http://master.php.net/manage/user-notes.php?action=edit+30476 http://master.php.net/manage/user-notes.php?action=delete+30476 http://master.php.net/manage/user-notes.php?action=reject+30476

« previous php.notes (#45511) next »