Hi, everyone!

I have come across a "feature" in PHP5 that is not a great problem to me, but has me puzzled. Can anyone shine some light on this?

The following snippet works fine:
$x->y = "hello";
echo "Let me say $x->y to you!\n";

However, if I modify $x->y (what I shall loosely call a one-dimensional object, analogous to arrays) to $x->y->z (a "two-dimensional object" for lack of a better term) as follows:
$x->y->z = "hello";
echo "Let me say $x->y->z to you!\n";

...this snippet generates the following error message:
Catchable fatal error: Object of class stdClass could not be converted to string

When I change it to:
$x->y->z = "hello";
echo "Let me say " . $x->y->z . " to you!\n";

... then all is well again. So that's the work-around, problem solved, fine... but what has me puzzled as to why this behavior occurs in the first place.

Ideas, anyone?

// FvW