dynamic access magic constants in php
<p>Is there a way to shortcut this:</p>

<pre><code>function a($where){
  echo $where;
}

function b(){
  a(basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__);
}
</code></pre>

<p>to something like this:</p>

<pre><code>    define("__myLocation__", ''.basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__.'');
    function a($where){
      echo $where;
    }

    function b(){
      a(__mYLocation_);
    }
</code></pre>

<p><strong>I know that this cannot be done with constants</strong> (is just an theoretical example), but I can't find a way to shorthen my code. If a use a function to get my line it will get the line where that function is not the line from where the function was called.</p>

<p>I usualy call a function that prints directly to the log file, but in my log I need to know from where the function was called, so i use <code>basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__</code> this will print something like:</p>

<pre><code>index.php::b()::6
</code></pre>

<p>It is a lot of code when you have over 500 functions in different files. Is there a shorten or better way to do this?</p>
