title: Track each function call dynamically
body: <p>I was wondering, can you make a function or something, that looks for other function calls across the site? I think, that if there is a master page, you could include it at the very top and it should work sitewise.</p>
  <p>But I have no idea how to do this.</p>
  <p>Kind of like <code>debug_backtrace();</code>, but global. In other words, a function that does something with a function that has been called after this function.</p>
  <p>Well, I see that you could do this with a specific <code>call_user_func();</code>, therefore track everything what's going on, but.. any dynamic way?</p>
  <p>Thanks in advance!</p>
  <h2>Goal</h2>
  <p>The goal of this is to dynamically keep chain of called functions. So at some moment, for example, I require a value back from 3rd function in chain, so I can simply retrieve it with something like <code>$calls[2]; // the stored returned value or an array containing info about function + returned value</code>.</p>
  <p>And it adds function data to chain on each call, where 1st call's <code>$key = 0</code>. So for debugging purposes, when my function fails which is <strong>x</strong> function in a row, I'd love to know information about previously called functions, maybe one has returned wrong value, resulting in error at some part later on.</p>