note 97259 deleted from function.echo by degeberg
| From: | degeberg@php.net | Date: | Sun, 11 Apr 2010 10:35:09 +0000 |
| Subject: | note 97259 deleted from function.echo by degeberg | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168125@lists.php.net to get a copy of this message | ||
Note Submitter: pamo
Reason: in docs
----
To print array elements where its keys are a mix of integers and strings with the "here
document" syntax you can use {} in the same way as nomal echo to eval first the value of the
variable. Note that doing it this way you have quote the string key.
<?php
$data = array();
$data[0]['foo'] = 'bar';
echo <<< INFO
<div>
---{$data[0]['foo']}---
</div>
INFO;
echo <<< INFO
<div>
---$data[0][foo]---
</div>
INFO;
?>
first print:
---bar---
second print:
---Array[foo]---