Re: Behavior of References with Classes

From: Date: Sun, 17 Dec 2000 07:03:36 +0000
Subject: Re: Behavior of References with Classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30725@lists.php.net to get a copy of this message
Ok, nevermind :) I figured it out.... and if the editors don't remove my annotation, there'll a (IMO) clearer explaination on the appropriate manual page. See http://www.php.net/manual/language.references.whatdo.php if you're curious. (Annotation not up quite yet; coming soon.) Toby Butzon [ criticism spurs improvement ] ----- Original Message ----- From: "Toby Butzon" <TButzon@ImAWebDesigner.com> To: "PHP List" <php-general@lists.php.net> Sent: Saturday, December 16, 2000 9:57 PM Subject: [PHP] Behavior of References with Classes : Somehow, the following lines from the PHP manual : (http://www.php.net/manual/language.references.whatdo.php) seem really : weirdio to me: : : "Note: Unless you use the syntax above, the result of $bar = new fooclass() : will not be the same variable as $this in the constructor, meaning that if : you have used reference to $this in the constructor, you should use : reference assignment, or you get two different objects." : : What I don't understand is this: if references are simply supposed to create : an alias to a variable's content... : : [ For example, the code... : $foo = "you"; : $bar = &$foo; : ...means in memory you have a value "you" that can be accessed/modified with : EITHER $foo or $bar.] : : ...then how does this end up creating multiple objects of the class? : : My apologies if I'm just stupid... it could be the wording that's confusing : me or it could just be that I'm a confused individual to begin with :) : : I'm just looking for some help or maybe general discussion... anything to : help get this straight in my head. :) Thanks all - : : Toby Butzon : [ criticism spurs improvement ] : : : : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net : For additional commands, e-mail: php-general-help@lists.php.net : To contact the list administrators, e-mail: php-list-admin@lists.php.net : :

« previous php.general (#30725) next »