[PHP] Unexpected results with object to array cast

2004-11-03 Thread Francisco M. Marzoa Alonso
This code: ?php class TestClass { private $self; function __construct () { $this-self = $this; } } $Obj = new TestClass (); print_r ( $Obj ); echo br; $Arr = (array) $Obj; print_r ( $Arr ); ? Produce the following output: TestClass Object ( [self:private] = TestClass Object

Re: [PHP] Unexpected results with object to array cast

2004-11-03 Thread Francisco M. Marzoa Alonso
Forget it, it has a lot of sense since self is a reference to the object itself, but the new array is not in the same memory than the source object, so result cannot be as I expected because self is no really self within the array, but a reference to an object outside it. The result its perfectly