title: Finding the PHP File (at run time) where a Class was Defined
body: <p>Is there any reflection/introspection/magic in PHP that will let you find the PHP file where a particular class (or function) was defined?</p>
  
  <p>In other words, I have the name of a PHP class, or an instantiated object.  I want to pass this to <strong>something</strong> (function, Reflection class, etc.) that would return the file system path where the class was defined.</p>
  
  <pre><code>/path/to/class/definition.php
  </code></pre>
  
  <p>I realize I could use (<code>get_included_files())</code> to get a list of all the files that have been included so far and then parse them all manually, but that's a lot of file system access for a single attempt.  </p>
  
  <p>I also realize I could write some additional code in our __autoload mechanism that caches this information somewhere.  However, modifying the existing __autoload is off limits in the situation I have in mind.</p>
  
  <p>Hearing about extensions that can do this would be interesting, but I'd ultimately like something that can run on a "stock" install.</p>