note 110441 added to function.require
| From: | wolfzoon at hotmail dot com | Date: | Mon, 22 Oct 2012 16:05:02 +0000 |
| Subject: | note 110441 added to function.require | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191484@lists.php.net to get a copy of this message | ||
Now that was some painful indentation, let me fix that for ya:
And shouldn't that final "$path" be "$path/$value"?
\quote
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/$value");
}
}
}
?>
Hope that helps !!!
----
Server IP: 83.137.20.135
Probable Submitter: 132.229.132.164
----
Manual Page -- http://www.php.net/manual/en/function.require.php
Edit -- https://master.php.net/note/edit/110441
Del: integrated -- https://master.php.net/note/delete/110441/integrated
Del: useless -- https://master.php.net/note/delete/110441/useless
Del: bad code -- https://master.php.net/note/delete/110441/bad+code
Del: spam -- https://master.php.net/note/delete/110441/spam
Del: non-english -- https://master.php.net/note/delete/110441/non-english
Del: in docs -- https://master.php.net/note/delete/110441/in+docs
Del: other reasons-- https://master.php.net/note/delete/110441
Reject -- https://master.php.net/note/reject/110441
Search -- https://master.php.net/manage/user-notes.php