PHP 4.0 Bug #7330 Updated: variable resolution in double quoted strings doesn't like a hierarchy of object
| From: | stas@php.net | Date: | Thu, 19 Oct 2000 10:55:45 +0000 |
| Subject: | PHP 4.0 Bug #7330 Updated: variable resolution in double quoted strings doesn't like a hierarchy of object | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35511@lists.php.net to get a copy of this message | ||
ID: 7330
Updated by: stas
Reported By: bbatchel@stetson.edu
Status: Closed
Bug Type: Unknown/Other Function
Assigned To:
Comments:
Use "<br>{$Object1->Object2->Data}<br>" for this.
Previous Comments:
---------------------------------------------------------------------------
[2000-10-19 03:23:32] bbatchel@stetson.edu
I am writing a database wrapper for a project I am working on. The gist of this system is based on
a hirearchy of objects - such as:
Object1:
Object2:
Data (say a string containing 'monkey')
Object3:
Data
Object4:
Data
When I do this:
echo($Ibject1->Object2->Data);
I get: monkey
When I do this:
echo("<br>$Object1->Object2->Data<br>");
I would expect to get:
<br>monkey<br>
But instead I get:
<br>Object->Data<br>
I assume that the parser is resolving $Object1->Object2 as the word object, and then
concatinating that to '->Data' as a string - instead of going down the line to the rest
of the variable.
Not a big deal, per se, but still a bug in my opinion.
For the mean time, I just assign the complex variable to a temporary variable and use that in the
string substitution.
Thanks,
--Bryan
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7330