Question

I have a MVC and I have a function: updateVisitor()

This function is called in visitors.php

And visitors.php is included once time with require_one

But the function is being executed three times, any idea? Is there any php debugger to see where are the functions being called from?

I can't code because it's very huge and I resume it very well

Was it helpful?

Solution

I suggest adding a call to debug_print_backtrace at the beginning of your function:

debug_print_backtrace(0, 3);

It will tell you where the function was called from.

If it prints too many lines, you can limit that by passing a parameter:

debug_print_backtrace(0, 3); // would print only 3 lines at each call

OTHER TIPS

There're at least two well-known debugging extensions (Xdebug and Zend Debugger) but you can track where a given function is being called with some of the builtin functions such as debug_print_backtrace().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top