function called_from_file(){
        $backtrace = debug_backtrace();
        print $backtrace[0]['file'];
}

check: http://www.php.net/manual/en/function.debug-backtrace.php

Samuel Ventura wrote:
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

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



Reply via email to