Re: get_class()

From: Date: Tue, 17 Apr 2001 16:34:47 +0000
Subject: Re: get_class()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49008@lists.php.net to get a copy of this message
"This function returns the name of the class of which the object obj is an instance." The name of the class is "myClass", therefore the behavior is as it should be. "thisInstance" is an object, not a class. If you are trying to do something imparticular you'll have to be more specific. As for getting the name "thisInstance", I'm not really sure why you'd need to, so I can't think of a work-around. Since "thisInstance" is the name of the object, you need some object related function. I've never had to do it, so I have no clue how, but maybe someone else will know :) -- Plutarck Should be working on something... ...but forgot what it was. ""Boget, Chris"" <Chris.Boget@wild.net> wrote in message news:4040BBE81A9AD411BD27009027887A7C042C85@tiger.wild.net... > Given the following code: > > ----- > > class myClass { > function myClass() { > $classVar = get_class( $this ); > > } > } > > $thisInstance = new myClass(); > > ----- > > What value should $classVar contain? > > "myClass" > > or > > "thisInstance" > > ? > The documentation leads me to believe that it is the > latter value, but in practice it contains the former. > If it is supposed to have the latter value, is there any > way I can get the fomer? Any way that I can get the > name "thisInstance"? > > Chris >

« previous php.general (#49008) next »