note 109877 added to function.require

From: Date: Thu, 30 Aug 2012 11:37:19 +0000
Subject: note 109877 added to function.require
Groups: php.notes 
Request: Send a blank email to php-notes+get-190270@lists.php.net to get a copy of this message
Here's a simple function to include all files from folder / subfolders. <?php function require_path($path) { $root = scandir($path); $files = array(); foreach($root as $value) { if($value === '.' || $value === '..') {continue;} if(is_file("$path/$value")) { $pInfo = pathinfo($value); if ($pInfo['extension'] == "php") { require_once("$path/$value"); echo "$path/$value<br>"; } } else { require_path($path); } } } ?> Hope that helps !!! ---- Server IP: 203.121.145.121 Probable Submitter: 78.96.160.252 ---- Manual Page -- http://www.php.net/manual/en/function.require.php Edit -- https://master.php.net/note/edit/109877 Del: integrated -- https://master.php.net/note/delete/109877/integrated Del: useless -- https://master.php.net/note/delete/109877/useless Del: bad code -- https://master.php.net/note/delete/109877/bad+code Del: spam -- https://master.php.net/note/delete/109877/spam Del: non-english -- https://master.php.net/note/delete/109877/non-english Del: in docs -- https://master.php.net/note/delete/109877/in+docs Del: other reasons-- https://master.php.net/note/delete/109877 Reject -- https://master.php.net/note/reject/109877 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#190270) next »