> I had that before. 
> OK, seems that my problem is not that simple. The thing is , 
> I have something 
> like this in my file test.php:
> require('my_api.inc');
> echo "This is test.php3";
> Now, in my_api.inc, I want to know that I run test.php3, when I do
> bash$ php test.php3
> and the filename is test.php3 .  __FILE__ will give my my_api.inc 
> instead.  I need it because my_api.inc do all sort of authenticating, 
> session, etc.

__FILE__ will give you the name of the file that uses that constant.
So, based on the above, I believe that you are using __FILE__ only
in my_api.inc (which is pretty much what you said, I'm just looking
for verification).

What you can do instead is this:

in "my_api.inc", have the following code:

echo "Currently Running file is: ";
echo ( $CurrentRunningFile ) ? $CurrentRunningFile : __FILE__;

in test.php

<?
  $CurrentRunningFile = __FILE__;

  include( "my_api.inc" );
  echo "This is test.php3<br>\n";
?>

Define "$CurrentRunningFile" on line one of all your files.  Or
something along those lines...

Chris

Reply via email to