From e50a121d8ebf66a4a991c362a5469dac909f44d9 Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Wed, 27 Jun 2001 05:44:14 +0000 Subject: [PATCH] documented issue in bug #9641 completely revamped get_included_files and get_required_files git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@50262 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/info.xml | 112 ++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/functions/info.xml b/functions/info.xml index 139de90145..68cd76c7e4 100644 --- a/functions/info.xml +++ b/functions/info.xml @@ -1599,8 +1599,7 @@ print_r (get_extension_funcs ("gd")); get_required_files - Returns an array with the names of the files require_once()'d or - included_once()'d in a script + Returns an array with the names of included or required files @@ -1608,32 +1607,28 @@ print_r (get_extension_funcs ("gd")); array get_required_files - + void - This function returns an array of the names of all - the files that have been loaded into a script using - require_once or include_once. - - - - In PHP 4.0.1pl2 this function assumed that the - required_once files end in the extension - ".php", other extensions do not work. Also, in that - version the array returned was an associative array, and this - function was not an alias for get_included_files - - - As of PHP 4.0.4, this function is an alias for - get_included_files - - - - See also: require_once, - include_once, + As of PHP 4.0.4, this function is an alias for get_included_files + + In PHP 4.0.1pl2 and previous versions + get_required_files assumed that the required + files ended in the extension .php, other + extensions would not be returned. The array returned by + get_required_files was an associative array + and only listed files included by require and + require_once. + + + See also: require, + require_once, include, + include_once and + get_included_files. + @@ -1641,8 +1636,7 @@ print_r (get_extension_funcs ("gd")); get_included_files - Returns an array with the names of the files include_once()'d in - a script + Returns an array with the names of included or required files @@ -1650,61 +1644,65 @@ print_r (get_extension_funcs ("gd")); array get_included_files - + void - This function returns an array of the names of all - the files that have been loaded into a script using - require_once or - include_once. + Returns an array of the names of all files that have been + included using include, + include_once, require + or require_once. + + + Files that are included or required multiple times only show up + once in the returned array. - The example below - Printing the required and included files - + <function>get_included_files</function> Example + <?php -require_once ("local.php"); -require_once ("../inc/global.php"); +include("test1.php"); +include_once("test2.php"); +require("test3.php"); +require_once("test4.php"); -for ($i=1; $i<5; $i++) - include "util".$i.".php"; +$included_files = get_included_files(); - echo "Required_once/Included_once files\n"; - print_r (get_required_files()); +foreach($included_files as $filename) { + echo "$filename\n"; +} + +?> will generate the following output: -Required_once/Included_once files -Array -( - [0] => local.php - [1] => /full/path/to/inc/global.php - [2] => util1.php - [3] => util2.php - [4] => util3.php - [5] => util4.php -) +test1.php +test2.php +test3.php +test4.php - In PHP 4.0.1pl2 this function assumed that the - include_once files end in the extension - ".php", other extensions do not work. Also, in that - version the array returned was an associative array, and - listed only the included files. + In PHP 4.0.1pl2 and previous versions + get_included_files assumed that the + required files ended in the extension .php; + other extensions would not be returned. The array returned by + get_included_files was an associative array + and only listed files included by include + and include_once. - See also: require_once, - include_once, - get_required_files + See also: include, + include_once, require, + require_once and + get_required_files.