Re: a simple reference variable question
From: Bent Stigsen (ngap_at_thevoid.dk)
Date: 10/02/04
- Previous message: the voigts: "intialising an empty array"
- In reply to: john: "Re: a simple reference variable question"
- Next in thread: john: "Re: a simple reference variable question"
- Reply: john: "Re: a simple reference variable question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 02 Oct 2004 04:31:23 +0200
john wrote:
[snip]
> // Insert a variable into an array
> $x = 0;
> $arr[] = & $x;
>
> // Function returns reference to the first element
> function & getX() { return $arr[0]; }
Another simplified example slip :) ?
You probably know that global variables are not accessible unless
explicitly specified, like:
function & getX() {
global $arr;
return $arr[0];
}
[snip]
> $myObj = & $myCollection->search("foo");
> $myObj->name = "bar";
Anyway, probaly not the problem in your real code, since global is not
used within classes.
Are you sure the code in your search method doesn't make a copy of the
object somewhere?
/Bent
- Previous message: the voigts: "intialising an empty array"
- In reply to: john: "Re: a simple reference variable question"
- Next in thread: john: "Re: a simple reference variable question"
- Reply: john: "Re: a simple reference variable question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|