danbeck Wed Jun 27 07:44:14 2001 EDT
Modified files:
/phpdoc/en/functions info.xml
Log:
documented issue in bug #9641
completely revamped get_included_files and get_required_files
Index: phpdoc/en/functions/info.xml
diff -u phpdoc/en/functions/info.xml:1.52 phpdoc/en/functions/info.xml:1.53
--- phpdoc/en/functions/info.xml:1.52 Wed Jun 27 05:52:38 2001
+++ phpdoc/en/functions/info.xml Wed Jun 27 07:44:14 2001
@@ -1599,8 +1599,7 @@
<refnamediv>
<refname>get_required_files</refname>
<refpurpose>
- 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
</refpurpose>
</refnamediv>
<refsect1>
@@ -1608,31 +1607,27 @@
<funcsynopsis>
<funcprototype>
<funcdef>array <function>get_required_files</function></funcdef>
- <void/>
+ <paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
<para>
- This function returns an array of the names of all
- the files that have been loaded into a script using
- <function>require_once</function> or <function>include_once</function>.
+ As of PHP 4.0.4, this function is an alias for
+ <function>get_included_files</function>
</para>
- <note>
- <para>
- In PHP 4.0.1pl2 this function assumed that the
- <varname>required_once</varname> 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 <function>get_included_files</function>
- </para>
- <para>
- As of PHP 4.0.4, this function is an alias for
- <function>get_included_files</function>
- </para>
- </note>
<para>
- See also: <function>require_once</function>,
- <function>include_once</function>,
- <function>get_included_files</function>
+ In PHP 4.0.1pl2 and previous versions
+ <function>get_required_files</function> assumed that the required
+ files ended in the extension <literal>.php</literal>, other
+ extensions would not be returned. The array returned by
+ <function>get_required_files</function> was an associative array
+ and only listed files included by <function>require</function> and
+ <function>require_once</function>.
+ </para>
+ <para>
+ See also: <function>require</function>,
+ <function>require_once</function>, <function>include</function>,
+ <function>include_once</function> and
+ <function>get_included_files</function>.
</para>
</refsect1>
</refentry>
@@ -1641,8 +1636,7 @@
<refnamediv>
<refname>get_included_files</refname>
<refpurpose>
- 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
</refpurpose>
</refnamediv>
<refsect1>
@@ -1650,61 +1644,65 @@
<funcsynopsis>
<funcprototype>
<funcdef>array <function>get_included_files</function></funcdef>
- <void/>
+ <paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
<para>
- This function returns an array of the names of all
- the files that have been loaded into a script using
- <function>require_once</function> or
- <function>include_once</function>.
+ Returns an array of the names of all files that have been
+ included using <function>include</function>,
+ <function>include_once</function>, <function>require</function>
+ or <function>require_once</function>.
+ </para>
+ <para>
+ Files that are included or required multiple times only show up
+ once in the returned array.
</para>
<para>
- The example below
<example>
- <title>Printing the required and included files</title>
- <programlisting>
+ <title><function>get_included_files</function> Example</title>
+ <programlisting role="php">
<?php
-require_once ("local.php");
-require_once ("../inc/global.php");
+include("test1.php");
+include_once("test2.php");
+require("test3.php");
+require_once("test4.php");
+
+$included_files = get_included_files();
-for ($i=1; $i<5; $i++)
- include "util".$i.".php";
+foreach($included_files as $filename) {
+ echo "$filename\n";
+}
- echo "Required_once/Included_once files\n";
- print_r (get_required_files());
+?>
</programlisting>
</example>
will generate the following output:
<informalexample>
<programlisting>
-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
</programlisting>
</informalexample>
</para>
<note>
<para>
- In PHP 4.0.1pl2 this function assumed that the
- <varname>include_once</varname> 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
+ <function>get_included_files</function> assumed that the
+ required files ended in the extension <literal>.php</literal>;
+ other extensions would not be returned. The array returned by
+ <function>get_included_files</function> was an associative array
+ and only listed files included by <function>include</function>
+ and <function>include_once</function>.
</para>
</note>
<para>
- See also: <function>require_once</function>,
- <function>include_once</function>,
- <function>get_required_files</function>
+ See also: <function>include</function>,
+ <function>include_once</function>, <function>require</function>,
+ <function>require_once</function> and
+ <function>get_required_files</function>.
</para>
</refsect1>
</refentry>