How to determine a function's outer context?
| From: | Alberto Serra | Date: | Wed, 03 Jul 2002 19:32:32 +0000 |
| Subject: | How to determine a function's outer context? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105267@lists.php.net to get a copy of this message | ||
Hi!
suppose we have this:
class utility {
function general_purpose($parm) {
some_process or
die("classname::callerfunction error with parm $parm") ;
}
}
class someclass {
var $utility;
function someclass() {
$this->utility = new utility;} function do_something() {
$this->utility->general_purpose("what-to-do");
}
}
Now, is there anyway we can trace that utility::general_purpose() is being called from within someclass::do_something() without explicitely passing a string among utility::general_purpose() parameters?
Apart from leading to more compact code writing this would avoid typo errors and give a more accurate tracing system. I am sure it can be done, but I cannot figure out how to do it myself.
Thanks
Alberto
Kiev
--
@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@
LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is.......