note 76247 deleted from language.types.string by danbrown

From: Date: Tue, 17 May 2011 14:18:44 +0000
Subject: note 76247 deleted from language.types.string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179811@lists.php.net to get a copy of this message
Note Submitter: michael at mahemoff dot com ---- Heredocs can be used for more than just echoing or setting variables - use them whenever you want to include a string. function header() { return <<<EOT <html> <head> <title>This is my heredoc</title> </head> <body> EOT; Also, note the strict syntax: - No semicolon after initial EOT (think of the heredoc as a literal string arg - you wouldn't want a semicolon in front of it, would you?) - BUT need semicolon after final EOT (the command is finished here) - Final EOT is on the left margin - don't indent it!

« previous php.notes (#179811) next »