Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Reference to reference?
February 1, 2007, 1:49 pm
rate this thread
I create object, then I store reference to this object into array.
Then I do so into another array. And suddenly I have two vars taken by
reference which should point to single object, but they are different.
Is there possibility of "reference to reference" in php?
I'm just going crazy, can't figure out everything...
Re: Reference to reference?
Why don't you post your code? Unfortunately, we didn't see you coding =
first hand, so we can't pinpoint what's wrong. This is an example of wha=
$o = new a('hello, world');
$o2 = new a('goodbye, cruel world');
$array['foo'] =& $o;
$array['foo2'] =& $o2;
echo $array['foo']->getFoo(); // outputs 'hello, world'
echo $array['foo']->getFoo(); // outputs 'como estas'
echo $o2->getFoo(); // outputs "kon'nichi wa"