John Nichel wrote:
> Michael Sims wrote:
>> John Nichel wrote:
>> Are you sure $bob is an object? It says above that it's an array.
>> If $bob were an object, print_r() should give "objectname Object"
>> instead of "Array".
>
> Nah, that's just my bad typing without thinking. When I
> print_r($bob), it does start....
>
> bob Object
Well, in that case let me address your original post:
John Nichel wrote:
> Now, I want to retrive the value of $bob->_four->gamma->word, but how?
> I've tried $bob->_four->gamma->word, $bob->_four['gamma']['word'],
That last one ($bob->_four['gamma']['word']) should work. It does here. This test
script:
---begin quote---
class bob {
var $one;
var $two;
var $three;
var $_four;
function bob() {
$this->one = 'this';
$this->two = 'that';
$this->three = array('alpha' => 'something');
$this->_four = array(
'beta' => 'another',
'gamma' => array('word' => 'up')
);
}
}
$bob = new bob;
print_r($bob);
print $bob->_four['gamma']['word']."\n";
----end quote----
prints:
---begin quote---
bob Object
(
[one] => this
[two] => that
[three] => Array
(
[alpha] => something
)
[_four] => Array
(
[beta] => another
[gamma] => Array
(
[word] => up
)
)
)
up
----end quote----
Do you get different results?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php