HELP: Detecting the name of the file a function is being called from
| From: | Samuel Ventura | Date: | Tue, 10 Feb 2004 04:17:09 +0000 |
| Subject: | HELP: Detecting the name of the file a function is being called from | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177247@lists.php.net to get a copy of this message | ||
Hi there
I have 2 scripts:
////////////////////////////////
<?php
/*
test1.php
*/
function called_from_file(){
print __FILE__
}
?>
///////////////////////////////
<?php
/*
test2.php
*/
include("test1.php");
called_from_file();
?>
/////////////////////////////////
I get the output
test1.php
what I need is to detect the name of the script
from which I called the function, (test2.php) in this
case.
For this application, it is not practical to pass an
aditional parameter to the function specifying the
caller, i need independence.
Any ideas?
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html