Reply to Re: [PHP] Re: Fw: Identify which function called another

Your name:

Reply:


Posted by Jochem Maas on 10/04/03 11:06

Ben Ramsey wrote:
> Lars B. Jensen wrote:
>
>> Is there any way, I from one function can identify which other
>> function called it, without parameter passing the name manually ?

I still question whether its correct to design a function which requires
this. I thought the idea of encapsulating code inside a function is that
its non-dependent/black-boxed.... still for every rule there is an
exception!

>
>
> Please don't post twice in an hour if you haven't yet received your
> answer. With that in mind, I have an answer for you. :-)

maybe Lars thought his post had disappeared into /dev/null, not
altogether strange considering the fluctuating time delays in posts
being sent out! then maybe he's an impatient s.o.b ;-)

>
> Use debug_backtrace():
> http://www.php.net/debug-backtrace
>
> Harry Fuecks has an excellent post on how to use debug_backtrace() here:
> http://www.sitepoint.com/blog-post-view.php?id=157007
>

He has a lot of those (excellent posts that is), but he is really giving
an example of debugging not writing code that relies on a debug_ function.

I don't think debug_backtrace() should be used like this, having said
that it will work - but I can only imagine that its a heavy function to
call (because it has to 'analyse' the stack in order to return alot of
info, nearly all of which is not needed in the case Lars presented)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация