note 38066 added to language.types.string
| From: | kmsluder at optonline dot net | Date: | Sun, 07 Dec 2003 02:26:09 +0000 |
| Subject: | note 38066 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61515@lists.php.net to get a copy of this message | ||
Be sure to use the complex syntax when accessing multiple levels of objects in a double-quoted
string:
<?php
class A
{
var $b;
function A()
{
b = new B();
}
}
class B
{
var $c;
function B()
{
c = 'Hello, world';
}
}
$a = new A();
echo "The value of c is: $a->b->c"
// Output: "The value of c is: Object->c" ***WRONG***
echo "The value of c is: {$a->b->c}"
// Output: "The value of c is: Hello, world"
?>
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38066
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38066&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38066&report=yes
Search -- http://master.php.net/manage/user-notes.php