note 45451 added to function.get-included-files
| From: | keystorm:at:gmaildotcom at osu1 dot php dot net | Date: | Tue, 07 Sep 2004 21:08:55 +0000 |
| Subject: | note 45451 added to function.get-included-files | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76167@lists.php.net to get a copy of this message | ||
As of PHP5, this function seems to return an array with the first index being the script all
subsequent scripts are included to.
If index.php includes b.php and c.php and calls get_included_files(), the returned array looks as
follows:
index.php
a.php
b.php
while in PHP<5 the array would be:
a.php
b.php
If you want to know which is the script that is including current script you can use
$_SERVER['SCRIPT_FILENAME'] or any other similar server global.
If you also want to ensure current script is being included and not run independently you should
evaluate following expression:
__FILE__ != $_SERVER['SCRIPT_FILENAME']
If this expression returns TRUE, current script is being included or required.
----
Manual Page -- http://www.php.net/manual/en/function.get-included-files.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45451
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45451&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45451&report=yes
Search -- http://master.php.net/manage/user-notes.php