[PHP-DOC] cvs: phpdoc /en/functions info.xml From: Daniel Beckham (danbeck <email protected>)
Date: 06/27/01

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
- &quot;.php&quot;, 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">
 &lt;?php
 
-require_once (&quot;local.php&quot;);
-require_once (&quot;../inc/global.php&quot;);
+include("test1.php");
+include_once("test2.php");
+require("test3.php");
+require_once("test4.php");
+
+$included_files = get_included_files();
 
-for ($i=1; $i&lt;5; $i++)
- include &quot;util&quot;.$i.&quot;.php&quot;;
+foreach($included_files as $filename) {
+ echo "$filename\n";
+}
 
- echo &quot;Required_once/Included_once files\n&quot;;
- print_r (get_required_files());
+?&gt;
       </programlisting>
      </example>
      will generate the following output:
      <informalexample>
       <programlisting>
-Required_once/Included_once files
-Array
-(
- [0] =&gt; local.php
- [1] =&gt; /full/path/to/inc/global.php
- [2] =&gt; util1.php
- [3] =&gt; util2.php
- [4] =&gt; util3.php
- [5] =&gt; 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
- &quot;.php&quot;, 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>