note 97259 added to function.echo
| From: | pamo at osu1 dot php dot net | Date: | Sat, 10 Apr 2010 17:52:48 +0000 |
| Subject: | note 97259 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168109@lists.php.net to get a copy of this message | ||
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]---
----
Server IP: 69.147.83.197
Probable Submitter: 189.137.8.35
----
Manual Page -- http://www.php.net/manual/en/function.echo.php
Edit -- https://master.php.net/note/edit/97259
Del: integrated -- https://master.php.net/note/delete/97259/integrated
Del: useless -- https://master.php.net/note/delete/97259/useless
Del: bad code -- https://master.php.net/note/delete/97259/bad+code
Del: spam -- https://master.php.net/note/delete/97259/spam
Del: non-english -- https://master.php.net/note/delete/97259/non-english
Del: in docs -- https://master.php.net/note/delete/97259/in+docs
Del: other reasons-- https://master.php.net/note/delete/97259
Reject -- https://master.php.net/note/reject/97259
Search -- https://master.php.net/manage/user-notes.php