note 88444 added to function.echo
| From: | Maikel at osu1 dot php dot net | Date: | Sat, 24 Jan 2009 17:34:23 +0000 |
| Subject: | note 88444 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149730@lists.php.net to get a copy of this message | ||
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"]
----
Server IP: 64.71.164.2
Probable Submitter: 201.248.234.101
----
Manual Page -- http://www.php.net/manual/en/function.echo.php
Edit -- https://master.php.net/note/edit/88444
Del: integrated -- https://master.php.net/note/delete/88444/integrated
Del: useless -- https://master.php.net/note/delete/88444/useless
Del: bad code -- https://master.php.net/note/delete/88444/bad+code
Del: spam -- https://master.php.net/note/delete/88444/spam
Del: non-english -- https://master.php.net/note/delete/88444/non-english
Del: in docs -- https://master.php.net/note/delete/88444/in+docs
Del: other reasons-- https://master.php.net/note/delete/88444
Reject -- https://master.php.net/note/reject/88444
Search -- https://master.php.net/manage/user-notes.php