get_included_files

(PHP 4 >= 4.0RC1)

get_included_files --  Returns an array with the names of the files include_once()'d in a script

Description

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().

The example below

Example 1. Printing the required and included files


<?php

require_once ("local.php");
require_once ("../inc/global.php");

for ($i=1; $i<5; $i++)
  include "util".$i.".php";

  echo "Required_once/Included_once files\n";
  print_r (get_required_files());
      
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 
)
      

Note: 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.

See also: require_once(), include_once(), get_required_files()