Why can't you access "deeper" object variables when said object variable is used in a string?
<p>What I mean is, while you can do something like this:</p>

<pre><code>$foo = "Yo dawg I herd you like $bar-&gt;baz";
</code></pre>

<p>This:</p>

<pre><code>$foo = "Yo dawg I herd you like $bar-&gt;baz-&gt;qux";
</code></pre>

<p>Results in the following error:</p>

<pre><code>"Object of class * could not be converted to string"
</code></pre>

<p>The cleanest way around it seems to be something like:</p>

<pre><code>$baz = $bar-&gt;baz;

$foo = "Yo dawg I herd you like $baz-&gt;qux";
</code></pre>

<p>So why doesn't it work and is there is a better solution?</p>

<p>NOTICE:</p>

<p>I know some people prefer to have their variables outside of their strings but this is not the venue to talk about such preferences and does not address the question I'm asking so I'd appreciate if you leave such subjective sentiments out of this. Thank you.</p>
