|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-05-22 21:36 UTC] jordanh at remotepoint dot com
<?
class child_t {
var $x;
}
class parent_t {
var $childs;
function makeChildArray() {
for ($i = 0; $i < 10; $i++) {
$this->childs[$i] = new child_t;
$this->childs[$i]->x = "Value #$i";
}
}
}
/* main() */
$parent = new parent_t;
$parent->makeChildArray();
/* Display the values from the "childs" array: */
for ($i = 0; isset($parent->childs[$i]->x); $i++) {
/* BUG: See attached note! */
echo "I am in a string context: $parent->childs[$i]->x!<br>";
echo "I am <u>not</u> in the string context:"
.$parent->childs[$i]->x."<br>";
}
?>
Compiled with: --with-gettext --with-mysql --with-apache=../apache_1.3.12
The first few lines of the above script is as follows:
I am in a string context: Array[0]->x!
I am not in the string context:Value #0
I am in a string context: Array[1]->x!
I am not in the string context:Value #1
Good Luck!
Jordan.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 05:00:01 2025 UTC |
Not a bug. If you want to have sull variable evaluation, use "{$obj->val}" syntax or just use printf.