note 88444 deleted from function.echo by danbrown
| From: | danbrown@php.net | Date: | Sat, 24 Jan 2009 17:52:32 +0000 |
| Subject: | note 88444 deleted from function.echo by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149731@lists.php.net to get a copy of this message | ||
Note Submitter: Maikel
----
The syntax to output multiple lines works with almost variables, but you must be careful with array
values. Let's check this
<?php
$var = "single var works";
$arr[1] = "array with index: numeric";
$arr["foo"] = "array with index: no numeric";
$obj->foo = "object property";
echo <<<FIN
¿is it works with variables?
$var
$arr[1]
$arr["foo"]
$obj->foo
FIN;
?>
That's generates syntax error, now let's try this:
<?php
$var = "single var works";
$arr[1] = "array with index: numeric";
$arr["foo"] = "array with index: no numeric";
$obj->foo = "object property";
echo <<<FIN
¿is it works with variables?
$var
$arr[1]
{$arr["foo"]}
$obj->foo
FIN;
?>
Please note the braces around of arr["foo"]