RE: [PHP] which class it is?

From: Date: Fri, 04 Mar 2005 09:41:01 +0000
Subject: RE: [PHP] which class it is?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-209966@lists.php.net to get a copy of this message
class DebugHelper { var $_str; function do($string) ( //here I want to know which class called this function do to trace the bug. $this->_str .= $string; ) function show() { return $this->_str; } } class B { function B() { $debug = &new DebugHelper; $debug->do('here'); ... } } Best regards, Yang Shiqi -----Original Message----- From: Jochem Maas [mailto:jochem@iamjochem.com] Sent: Friday, March 04, 2005 4:43 PM To: yangshiqi Cc: php-general@lists.php.net Subject: Re: [PHP] which class it is? yangshiqi wrote: > I have a question that how to get the class name, which is initialized by > other class or function. > ... > > > How can I get class b's name in a? > you have the get_class() function, you have the __CLASS__ constant.... can you give an example of a situation where you are having trouble of retrieving the className of a subclassed object (or class)? > > > > > Best regards, > > Yang Shiqi > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#209966) next »