@ 2014-07-03T11:35:36Z <?php
/**
* Vloží všetky súbory v zadanom adresári do volajúceho skriptu
* a pokúsi sa ich spracovať ako PHP kód (nezáleží na prípone).
*
* @author Jakub Kubíček <kelerest123@gmail.com>
*
* @param string adresár z ktorého sa majú načítať súbory
* @param array vložia sa iba vymenované súbory (voliteľný)
* @return void
* @throws DomainException ak adresár alebo niektorý/é zo zadaných súborov v druhom parametri neexistuje
*
*/
function includeRecursive($dir, $files = array()) {
if(!is_dir($dir) || !$dh = opendir($dir)) throw new DomainException();
array_walk($files, function($item) use($dir) {
$path = $dir . PATH_SEPARATOR . $item;
if(!is_file($path)) throw new DomainException();
});
if(count($files)) {
foreach($files as $file) require($dir . PATH_SEPARATOR . $item);
} else {
while($file = readdir($dh) !== false) {
if(is_file($file)) require($file);
}
}
closedir($dh);
//return;
}
includeRecursive('/');
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.4.26 - 7.4.32 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/qkBA7 on line 17
Fatal error: Uncaught DomainException in /in/qkBA7:17
Stack trace:
#0 /in/qkBA7(37): includeRecursive('/')
#1 {main}
thrown in /in/qkBA7 on line 17
Process exited with code 255 . Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.34 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.25 , 7.4.33 , 8.0.0 - 8.0.13 Output for 5.2.3 - 5.2.17 Parse error: syntax error, unexpected T_FUNCTION in /in/qkBA7 on line 19
Process exited with code 255 . Output for 5.1.0 - 5.1.6 , 5.2.0 - 5.2.2 <br />
<b>Parse error</b>: syntax error, unexpected T_FUNCTION in <b>/in/qkBA7</b> on line <b>19</b><br />
Process exited with code 255 . Output for 5.0.0 - 5.0.5 <br />
<b>Parse error</b>: parse error, unexpected T_FUNCTION in <b>/in/qkBA7</b> on line <b>19</b><br />
Process exited with code 255 . Output for 4.4.2 - 4.4.9 <br />
<b>Parse error</b>: syntax error, unexpected T_NEW in <b>/in/qkBA7</b> on line <b>17</b><br />
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 <br />
<b>Parse error</b>: parse error, unexpected T_NEW in <b>/in/qkBA7</b> on line <b>17</b><br />
Process exited with code 255 . Output for 4.3.2 - 4.3.4 <br />
<b>Parse error</b>: parse error in <b>/in/qkBA7</b> on line <b>17</b><br />
Process exited with code 255 . preferences:dark mode live preview
320.92 ms | 401 KiB | 468 Q