note 60437 deleted from function.include by tomsommer

From: Date: Fri, 03 Mar 2006 10:27:36 +0000
Subject: note 60437 deleted from function.include by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-104755@lists.php.net to get a copy of this message
Note Submitter: ajsharp at gmail dot com ---- Does anyone know if PHP has a function to find out which script has included another, for example: "a.php" <?php include './b.php'; ?> "b.php" <?php // function to find out what script included b.php echo 'Hello world.'; ?> Such a function seems a bit pointless in such a simple script, but it could come in handy if one had a sitewide variables script. You could use a switch or if statment to load specific variables, which would be determined by which script included the variables page. For example: "variables.php" <?php switch ($includer) { case 'this_script.php': $this_variable = 'hello john'; break; case 'that_script.php': $that_variable = 'hello jane'; break; } ?>

« previous php.notes (#104755) next »