note 22911 added to function.get-included-files

From: Date: Thu, 04 Jul 2002 00:59:39 +0000
Subject: note 22911 added to function.get-included-files
Groups: php.notes 
Request: Send a blank email to php-notes+get-32565@lists.php.net to get a copy of this message
When using this function with PHP 4.2.1, I got this output for "print_r(get_included_files());" which hints at the fact that the array may actually contain full paths, not just the filenames as the example shows. Array ( [0] => /usr/home/sites/x.its-explosive.net/web/Misc. Classes/get_text.class.php [1] => /usr/home/sites/x.its-explosive.net/web/Misc. Classes/dic/es.lang.php [2] => /usr/home/sites/x.its-explosive.net/web/Misc. Classes/buffer.class.php ) If you're looking for a specific filename, I suggest using something like: $is_included = get_included_files(); foreach ($is_included as $i) { $files = explode("/",$i); $is_included = in_array("file.php",$files); if ($is_included == TRUE) { break; } } if($is_included != TRUE) { if(file_exists("file.php")) { include("file.php"); } } -- http://www.php.net/manual/en/function.get-included-files.php http://master.php.net/manage/user-notes.php?action=edit+22911 http://master.php.net/manage/user-notes.php?action=delete+22911 http://master.php.net/manage/user-notes.php?action=reject+22911

« previous php.notes (#32565) next »