Greetings, "Ali Çevik".
In reply to Your message dated Sunday, September 7, 2008, 1:51:33,

>>>> I need a procedure or an implementation that gives path of the class file
>>>> of
>>>> an object which I pass as a parameter.
>>>>
>>>> Example;
>>>>
>>>> Assume I have a class file located at C:\htdocs\Foo.class.php
>>>>
>>>> In code after I include Foo.class.php;
>>>>
>>>> <?php
>>>> $foo = new Foo();
>>>> Echo some_procedure($foo);
>>>> ?>
>>>>
>>>> I'm looking an implementation for that "some_procedure", which would make
>>>> this program to print C:\htdocs\Foo.class.php .
>>>> I have been googling around and also checked php.net but I wasn't able
>>>> to
>>>> find anything about this subject.
>>>>
>>>> It would be really helpful if someone knows that kind of procedure or at
>>>> least has an implementation of it.
>>>>
>>>
>>> The only way I know to do this would be to add a method to your class to
>>> give it to you.
>>>
>>> class Foo
>>> {
>>>    public function getClassFilename()
>>>    {
>>>        return __FILE__;
>>>    }
>>> }

>     Hmm, that should do the trick. Thanks a lot!
>     But still, I wish there were a way of doing that, without altering the
> class behaviour.

(top posting fixed)

Ok, if you prefer backward solution - hook your own error-handler and cause an
error in class, then you'll have path to it's file in backtrace.
I mean, knowing the filename of this or that function absolutely meaningless,
unless you're running into problem of some sort.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to