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
This commit is contained in:
Daniel Beckham 2001-06-27 05:44:14 +00:00
parent 5af5696178
commit e50a121d8e

View file

@ -1599,8 +1599,7 @@ print_r (get_extension_funcs ("gd"));
<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,32 +1607,28 @@ print_r (get_extension_funcs (&quot;gd&quot;));
<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>.
</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>,
As of PHP 4.0.4, this function is an alias for
<function>get_included_files</function>
</para>
<para>
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 @@ print_r (get_extension_funcs (&quot;gd&quot;));
<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 @@ print_r (get_extension_funcs (&quot;gd&quot;));
<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");
for ($i=1; $i&lt;5; $i++)
include &quot;util&quot;.$i.&quot;.php&quot;;
$included_files = get_included_files();
echo &quot;Required_once/Included_once files\n&quot;;
print_r (get_required_files());
foreach($included_files as $filename) {
echo "$filename\n";
}
?&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>