[thelist] PHP -name of include sourcefile

shawn allen shawn at alterior.net
Tue Dec 3 11:48:01 CST 2002


quoth Aleem Bawany:
> If I have a file a.php which has the following line:
>
> include("b.php");
>
> is there any way to determine in file b.php which file is calling the
> include for b.php (in this case, I want to determine a.php's name in
> b.php)

Not that I know of. You could set a variable before including it,
though:

$parent = __FILE__;
include 'b.php';
// compare $parent in b.php

--
shawn allen
  mailto://shawn@alterior.net
  phone://415.577.3961
  http://alterior.net
  aim://shawnpallen




More information about the thelist mailing list