RsD0p9BK
12/23/2015 - 5:02 AM

file_that_call_fnc.php

// Get the __FILE__ constant for a function's caller in PHP

include "bar.php";
call_it();

//bar.php
function call_it() {
  $bt =  debug_backtrace();
  echo "Calling file: ". $bt[0]['file'] . ' line  '. $bt[0]['line'];
}

// http://stackoverflow.com/questions/1801928/get-the-file-constant-for-a-functions-caller-in-php