Richard is right.

If you want to get where __FILE__ is exactly in, __FILE__ is the option.
Else, use $_SERVER['PHP_SELF']. (And this should be what you expected)


Regards,
Shelley


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Boget
Sent: Thursday, December 20, 2007 10:37 PM
To: PHP General
Subject: [PHP] Which file called the function?

Let's say I have the following 3 files

global.php
<?
  function myFunc() { echo __FILE__; }
?>

one.php
<?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?>

two.php
<?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?>

In each case, what is echoed out for __FILE__ is global.php.  Apart from 
analyzing the debug_backtrace array, is there any way that myFunc() would 
display "one.php" and "two.php" respectively?

thnx,
Christoph

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to