note 47180 modified in function.print by betz
| From: | betz@php.net | Date: | Fri, 05 Nov 2004 10:47:47 +0000 |
| Subject: | note 47180 modified in function.print by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80131@lists.php.net to get a copy of this message | ||
HERE Documents can reference arrays as long as you enclose
the vars in {}.
Like this:
<?php
$line = array( 'title' => "Hello", 'date' => 'Today');
echo <<<EOT
Title: {$line['title']}
Date: {$line['date']}
EOT;
?>
Run this and get
Title: Hello
Date: Today
More info here, scroll down to "heredoc syntax":
http://www.php.net/manual/en/language.types.string.php
--was--
The previous post is wrong.
HERE Documents can reference arrays as long as you enclose
the vars in {}.
Like this:
<?
$line = array( 'title' => "Hello", 'date' => 'Today');
echo <<<EOT
Title: {$line['title']}
Date: {$line['date']}
EOT;
?>
Run this and get
Title: Hello
Date: Today
More info here, scroll down to "heredoc syntax":
http://www.php.net/manual/en/language.types.string.php
http://php.net/manual/en/function.print.php