title: Get the line that the function was called at?
body: <p>I've looked this up and I know that the answer probably involves the use of <a href="http://php.net/manual/en/function.debug-backtrace.php" rel="nofollow"><code>debug_backtrace()</code></a>, but I am struggling on how to use it or exactly what it does.</p>
  
  <p>Basically, if this was index.php:</p>
  
  <pre><code>&lt;?php
  //some code
  //some more code
  
  require "functions.php";
  
  print_line();
  
  //some code
  
  print_line();
  ?&gt;
  </code></pre>
  
  <p>and functions.php was:</p>
  
  <pre><code>&lt;?php
  function print_line(){
      $line="[line that this function was called at]";
      print "This function was called from line $line of index.php&lt;br /&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>What would be the correct way of setting <code>$line</code> so that the output would be:</p>
  
  <pre><code>This function was called from line 7 of index.php
  This function was called from line 11 of index.php
  </code></pre>